Skip to content

Commit bda56b4

Browse files
authored
fix(helm): Update annotations during releasing (#13197)
1 parent 09acc8f commit bda56b4

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/release-1-create-pr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ jobs:
8080
sed -ri "0,/version/s/version: \S+/$NEW_CHART_VERSION/" helm/defectdojo/Chart.yaml
8181
fi
8282
83+
- name: Update values in HELM chart
84+
run: |
85+
yq -i '.annotations."artifacthub.io/prerelease" = "false"' helm/defectdojo/Chart.yaml
86+
yq -i '.annotations."artifacthub.io/changes" += "- kind: changed\n description: Bump DefectDojo to ${{ inputs.release_number }}\n"' helm/defectdojo/Chart.yaml
87+
8388
- name: Check version numbers
8489
run: |
8590
grep -H version dojo/__init__.py

.github/workflows/release-3-master-into-dev.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ jobs:
7474
git add docs/content/en/open_source/upgrading/$minorv.md
7575
if: endsWith(inputs.release_number_new, '.0') && endsWith(inputs.release_number_dev, '.0-dev')
7676

77+
- name: Update values in HELM chart
78+
run: |
79+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
80+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
81+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
82+
7783
- name: Run helm-docs
7884
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
7985
with:
@@ -144,6 +150,12 @@ jobs:
144150
grep appVersion helm/defectdojo/Chart.yaml
145151
grep version components/package.json
146152
153+
- name: Update values in HELM chart
154+
run: |
155+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
156+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
157+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
158+
147159
- name: Run helm-docs
148160
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
149161
with:

.github/workflows/test-helm-chart.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ jobs:
6565
run: ct lint --config ct.yaml --target-branch ${{ env.ct-branch }} --check-version-increment=false
6666
if: env.changed == 'true'
6767

68+
- name: Check update of "artifacthub.io/changes" HELM annotation
69+
if: env.changed == 'true'
70+
run: |
71+
target_branch=${{ env.ct-branch }}
72+
73+
echo "Checking Chart.yaml annotation changes"
74+
75+
# Get current branch annotation
76+
current_annotation=$(yq e '.annotations."artifacthub.io/changes"' "helm/defectdojo/Chart.yaml")
77+
78+
# Get target branch version of Chart.yaml annotation
79+
target_annotation=$(git show "${{ env.ct-branch }}:helm/defectdojo/Chart.yaml" | yq e '.annotations."artifacthub.io/changes"' -)
80+
81+
if [[ "$current_annotation" == "$target_annotation" ]]; then
82+
echo "::error file=helm/defectdojo/Chart.yaml::The 'artifacthub.io/changes' annotation has not been updated compared to ${{ env.ct-branch }}"
83+
exit 1
84+
fi
85+
86+
echo "'artifacthub.io/changes' annotation updated in helm/defectdojo"
87+
6888
# - name: Create kind cluster
6989
# uses: helm/kind-action@v1.1.0
7090
# if: env.changed == 'true'

helm/defectdojo/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ dependencies:
1717
version: ~19.6.4
1818
repository: "oci://us-docker.pkg.dev/os-public-container-registry/defectdojo"
1919
condition: redis.enabled
20+
annotations:
21+
artifacthub.io/prerelease: "true"
22+
artifacthub.io/changes: ""

0 commit comments

Comments
 (0)