Skip to content

Commit 8702583

Browse files
Merge branch 'main' into insecure-tls-oss
2 parents 4214888 + eeaa468 commit 8702583

File tree

19 files changed

+155
-114
lines changed

19 files changed

+155
-114
lines changed

.github/workflows/pr-issue-validator.yaml

Lines changed: 90 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
branches:
1111
- 'main'
1212
- 'release-**'
13+
- 'develop'
1314
# paths-ignore:
1415
# - 'docs/**'
1516
# - '.github/'
@@ -42,7 +43,6 @@ jobs:
4243
PRNUM: ${{ github.event.pull_request.number }}
4344
TITLE: ${{ github.event.pull_request.title }}
4445
run: |
45-
set -x
4646
echo "base or target repo : ${{ github.event.pull_request.base.repo.full_name }}"
4747
echo "head or source repo : ${{ github.event.pull_request.head.repo.full_name }}"
4848
if [[ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} ]]; then
@@ -169,78 +169,105 @@ jobs:
169169
pr_no: ${{ github.event.pull_request.number }}
170170
GH_TOKEN: ${{ github.token }}
171171
run: |
172-
173172
# Fetch the latest changes from the main branch
174173
git fetch origin main
175-
174+
176175
# Get the list of changed files
177176
git diff origin/main...HEAD --name-only > diff
178-
177+
178+
# Specify the directory containing migration files
179+
MIGRATION_DIR="scripts/sql"
180+
ls
181+
pwd
182+
183+
# Print changed files
179184
echo "Changed files:"
180185
cat diff
181-
182-
echo "Changed SQL files-:"
183-
# Filter SQL files from the list of changed files
184-
awk '/scripts\/sql\//' diff
185-
186-
# Count the number of changed SQL files in the 'scripts/sql' directory
187-
count=$(awk '/scripts\/sql\//' diff | wc -l)
188-
189-
# Check if no SQL files were changed
190-
if [[ $count == "0" ]]; then
191-
echo "No SQL files were added, Exiting from this action."
192-
exit 0
193-
fi
194-
195-
# Iterate through each changed SQL file
196-
for filename in $(awk '/scripts\/sql\//' diff); do
197-
echo "Checking File: $filename"
186+
187+
changed_files=""
188+
while IFS= read -r file; do
189+
if [[ $file == $MIGRATION_DIR/* && $file == *.up.sql ]]; then
190+
changed_files+="$file\n"
191+
fi
192+
done < diff
193+
194+
# Print the filtered .up.sql files
195+
echo "Filtered .up.sql files:"
196+
echo -e "$changed_files"
197+
198+
# Check if there are any .up.sql migration files in the changed files list
199+
if [ -z "$changed_files" ]; then
200+
echo "No .up.sql migration files found in the changes."
201+
else
202+
# Extract unique migration numbers from the directory (considering only .up.sql files)
203+
existing_migrations=$(ls $MIGRATION_DIR | grep -E "\.up\.sql$" | grep -oE "[0-9]{3}[0-9]{3}[0-9]{2}" | sort | uniq)
198204
199-
# Check if the SQL file name is in the correct format (i.e., it ends with either '.up.sql' or '.down.sql')
200-
if [[ "$filename" =~ \.(up|down)\.sql$ ]]; then
201-
202-
# Print a message that the file name is in the correct format
203-
echo "File name: $filename is in the correct format"
204-
else
205-
# Print an error message
206-
echo "Error: The SQL file name is not in the correct format: $filename."
207-
208-
# Post a comment on a GitHub pull request with the error message
209-
gh pr comment $pr_no --body "The SQL file name: $filename is not in the correct format."
210-
211-
# Exit the script with a non-zero status code
212-
exit 1
213-
fi
214-
215-
# Navigate to the SQL files directory
216-
sql_dir="scripts/sql"
217-
echo "Current directory: $(pwd)"
218-
cd "$sql_dir"
219-
echo "SQL files directory: $(pwd)"
205+
# Exclude migration numbers from changed files in existing_migrations
206+
while read -r file; do
207+
migration_number=$(basename "$file" | grep -oE "[0-9]{3}[0-9]{3}[0-9]{2}")
208+
existing_migrations=$(echo "$existing_migrations" | grep -v "$migration_number")
209+
done <<< "$changed_files"
220210
221-
# Extract the migration number from the SQL file name
222-
migration_no=$(echo "$filename" | cut -d "/" -f 3 | cut -d "_" -f 1)
223-
echo "Migration Number: $migration_no"
211+
# Validate each changed .up.sql migration file
212+
is_valid=true
213+
processed_migrations=()
214+
while read -r file; do
215+
# Extract migration number from the filename
216+
migration_number=$(basename "$file" | grep -oE "[0-9]{3}[0-9]{3}[0-9]{2}")
224217
225-
# Count the number of files with the same migration number
226-
migration_files_present_of_this_no=$(ls | cut -d "_" -f 1 | grep -w -c "$migration_no")
227-
228-
# Navigate back to the original directory
229-
cd ../..
218+
# Check if the filename has the full XXXPPPNN format
219+
if [[ ! $(basename "$file") =~ ^[0-9]{3}[0-9]{3}[0-9]{2}_ ]]; then
220+
echo "Error: Migration file $file does not have the complete XXXPPPNN format."
221+
is_valid=false
222+
continue
223+
fi
230224
231-
# Check the conditions based on the number of files with the same migration number
232-
if [[ $migration_files_present_of_this_no == "2" ]]; then
233-
echo "All looks good for this migration number."
234-
elif [[ $migration_files_present_of_this_no == "1" ]]; then
235-
# Only one file is present for this migration number
236-
echo "Only single migration file was present for migration no.: $migration_no. either up or down migration is missing! EXITING"
237-
gh pr comment $pr_no --body "Error: Only a single migration file was present for this number: $migration_no."
238-
exit 1
239-
else
240-
# Migration number is repeated
241-
echo "Error: Migration number is repeated."
242-
gh pr comment $pr_no --body "Error: The SQL file number: $migration_no is duplicated"
225+
if [ -z "$migration_number" ]; then
226+
echo "Warning: Could not extract migration number from $file."
227+
continue
228+
fi
229+
230+
# Check if this migration number has already been processed
231+
if [[ " ${processed_migrations[@]} " =~ " $migration_number " ]]; then
232+
continue
233+
fi
234+
processed_migrations+=("$migration_number")
235+
236+
# Check if the migration number is unique
237+
if echo "$existing_migrations" | grep -q "$migration_number"; then
238+
echo "Error: Migration number $migration_number already exists."
239+
is_valid=false
240+
fi
241+
242+
# Check if the migration number is greater than previous ones
243+
last_migration=$(echo "$existing_migrations" | tail -n 1)
244+
if [ "$migration_number" -le "$last_migration" ]; then
245+
echo "Error: Migration number $migration_number is not greater than the latest ($last_migration)."
246+
is_valid=false
247+
fi
248+
249+
# Check for sequential hotfix requirement (if NN > 01, check for NN-1)
250+
hotfix_number=$(echo "$migration_number" | grep -oE "[0-9]{2}$")
251+
if [ "$hotfix_number" -gt "01" ]; then
252+
previous_hotfix=$(printf "%02d" $((10#$hotfix_number - 1)))
253+
expected_previous_number="${migration_number:0:6}$previous_hotfix"
254+
if ! echo "$existing_migrations" | grep -q "$expected_previous_number"; then
255+
echo "Error: Previous hotfix migration $expected_previous_number not found for $migration_number."
256+
is_valid=false
257+
fi
258+
fi
259+
260+
done <<< "$changed_files"
261+
262+
if [ "$is_valid" = false ]; then
263+
echo "Validation failed. Please fix the errors before merging."
264+
gh pr comment $pr_no --body "The Migration files providede inside of the PR does not pass the criteria!!"
243265
exit 1
244266
fi
245-
done
267+
268+
echo "All .up.sql migration file validations passed."
269+
gh pr comment $pr_no --body "The migration files have successfully passed the criteria!!"
270+
fi
271+
272+
246273

CHANGELOG/release-notes-v1.0.1.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## v1.0.1
2+
3+
## Bugs
4+
- fix: server version on updating fix (#6079)
5+
- fix: all module installation fix (#6083)
6+
- fix: cluster namespace list informer (#6069)
7+
## Documentation
8+
- doc: Updated Readme for K8s Dashboard & Devtron platform (#6074)
9+
10+

charts/devtron/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: devtron-operator
3-
appVersion: 1.0.0
3+
appVersion: 1.0.1
44
description: Chart to configure and install Devtron. Devtron is a Kubernetes Orchestration system.
55
keywords:
66
- Devtron
@@ -11,7 +11,7 @@ keywords:
1111
- argocd
1212
- Hyperion
1313
engine: gotpl
14-
version: 0.22.77
14+
version: 0.22.78
1515
sources:
1616
- https://github.com/devtron-labs/charts
1717
dependencies:

charts/devtron/devtron-bom.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ global:
1010
containerRegistry: "quay.io/devtron"
1111
extraManifests: []
1212
installer:
13-
release: "v1.0.0"
13+
release: "v1.0.1"
1414
registry: ""
1515
image: "inception"
1616
tag: "473deaa4-185-21582"
@@ -38,8 +38,8 @@ components:
3838
imagePullPolicy: IfNotPresent
3939
devtron:
4040
registry: ""
41-
image: "hyperion:15cf0137-280-27017"
42-
cicdImage: "devtron:15cf0137-434-27015"
41+
image: "hyperion:50575235-280-27099"
42+
cicdImage: "devtron:50575235-434-27098"
4343
imagePullPolicy: IfNotPresent
4444
customOverrides: {}
4545
ciRunner:

charts/devtron/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ global:
2424
extraManifests: []
2525
installer:
2626
repo: "devtron-labs/devtron"
27-
release: "v1.0.0"
27+
release: "v1.0.1"
2828
registry: ""
2929
image: inception
3030
tag: 473deaa4-185-21582
@@ -81,8 +81,8 @@ components:
8181
imagePullPolicy: IfNotPresent
8282
devtron:
8383
registry: ""
84-
image: "hyperion:15cf0137-280-27017"
85-
cicdImage: "devtron:15cf0137-434-27015"
84+
image: "hyperion:50575235-280-27099"
85+
cicdImage: "devtron:50575235-434-27098"
8686
imagePullPolicy: IfNotPresent
8787
customOverrides: {}
8888
serviceMonitor:

internal/sql/repository/AppListingRepository.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ func (impl AppListingRepositoryImpl) FetchJobs(appIds []int, statuses []string,
124124
impl.Logger.Error(appsErr)
125125
return jobContainers, appsErr
126126
}
127-
jobContainers = impl.extractEnvironmentNameFromId(jobContainers)
127+
jobContainers, err := impl.extractEnvironmentNameFromId(jobContainers)
128+
if err != nil {
129+
impl.Logger.Errorw("Error in extractEnvironmentNameFromId", "jobContainers", jobContainers, "err", err)
130+
return nil, err
131+
}
128132
return jobContainers, nil
129133
}
130134

@@ -137,7 +141,11 @@ func (impl AppListingRepositoryImpl) FetchOverviewCiPipelines(jobId int) ([]*bea
137141
impl.Logger.Error(appsErr)
138142
return jobContainers, appsErr
139143
}
140-
jobContainers = impl.extractEnvironmentNameFromId(jobContainers)
144+
jobContainers, err := impl.extractEnvironmentNameFromId(jobContainers)
145+
if err != nil {
146+
impl.Logger.Errorw("Error in extractEnvironmentNameFromId", "jobContainers", jobContainers, "err", err)
147+
return nil, err
148+
}
141149
return jobContainers, nil
142150
}
143151

@@ -732,7 +740,7 @@ func (impl AppListingRepositoryImpl) FindAppCount(isProd bool) (int, error) {
732740
return count, nil
733741
}
734742

735-
func (impl AppListingRepositoryImpl) extractEnvironmentNameFromId(jobContainers []*bean.JobListingContainer) []*bean.JobListingContainer {
743+
func (impl AppListingRepositoryImpl) extractEnvironmentNameFromId(jobContainers []*bean.JobListingContainer) ([]*bean.JobListingContainer, error) {
736744
var envIds []*int
737745
for _, job := range jobContainers {
738746
if job.EnvironmentId != 0 {
@@ -742,7 +750,11 @@ func (impl AppListingRepositoryImpl) extractEnvironmentNameFromId(jobContainers
742750
envIds = append(envIds, &job.LastTriggeredEnvironmentId)
743751
}
744752
}
745-
envs, _ := impl.environmentRepository.FindByIds(envIds)
753+
envs, err := impl.environmentRepository.FindByIds(envIds)
754+
if err != nil {
755+
impl.Logger.Errorw("Error in getting environment", "envIds", envIds, "err", err)
756+
return nil, err
757+
}
746758

747759
envIdNameMap := make(map[int]string)
748760

@@ -759,5 +771,5 @@ func (impl AppListingRepositoryImpl) extractEnvironmentNameFromId(jobContainers
759771
}
760772
}
761773

762-
return jobContainers
774+
return jobContainers, nil
763775
}

manifests/install/devtron-installer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ metadata:
44
name: installer-devtron
55
namespace: devtroncd
66
spec:
7-
url: https://raw.githubusercontent.com/devtron-labs/devtron/v1.0.0/manifests/installation-script
7+
url: https://raw.githubusercontent.com/devtron-labs/devtron/v1.0.1/manifests/installation-script

manifests/installation-script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
LTAG="v1.0.0";
1+
LTAG="v1.0.1";
22
REPO_RAW_URL="https://raw.githubusercontent.com/devtron-labs/devtron/";
33

44
log("executed devtron setup installation");

manifests/release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
stable -1 v1.0.0
1+
stable -1 v1.0.1

manifests/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0.0
1+
v1.0.1

0 commit comments

Comments
 (0)