Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bitnami/*] ci: 👷 Add tag and changelog support #25359

Merged
merged 6 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
with:
path: charts
fetch-depth: 2 # to be able to obtain files changed in the latest commit
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is BITNAMI_BOT_TOKEN required? This could trigger other workflows, is that expected? If you need write access to the repository you can change the permissions section int the job definition.

permissions:
contents: read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need write access to push the tags

- id: get-chart
name: 'Get modified charts'
run: |
Expand Down Expand Up @@ -59,6 +60,21 @@ jobs:
with:
script: |
core.setFailed('${{ steps.get-chart.outputs.error }}')
- id: push-tag
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the best place to push the tag, at this point the chart is not yet published and the repository is not updated with the new version. We can reach a situation where the tag is created and the chart is not published. We could leave this job as read-only and create a new job depending on the update-index to push the tag if everything went well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, several in several repositories release jobs get triggered when a tag is set, right?

name: 'Push tag'
if: ${{ steps.get-chart.outputs.result == 'ok' }}
env:
CHART: ${{ steps.get-chart.outputs.chart }}
run: |
cd charts
# Get chart version and list of tags
chart_version="$(yq e '.version' bitnami/${CHART}/Chart.yaml)"
git fetch --tags
# If the tag does not exist, create and push it (this allows re-executing the job)
if ! git tag | grep ${CHART}/${chart_version}; then
git tag ${CHART}/${chart_version}
git push --tags
fi
vib-publish:
runs-on: ubuntu-latest
needs: get-chart
Expand Down Expand Up @@ -107,7 +123,7 @@ jobs:
curl -SsLfO "https://get.helm.sh/${HELM_TARBALL}" && sudo tar xf "$HELM_TARBALL" --strip-components 1 -C /usr/local/bin
- id: update-index
name: Fetch chart and update index
env:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PUBLISH_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PUBLISH_SECRET_ACCESS_KEY }}
AWS_ASSUME_ROLE_ARN: ${{ secrets.AWS_PUBLISH_ROLE_ARN }}
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
update-pr:
runs-on: ubuntu-latest
needs: [get-chart]
name: Automatically update README and CRDs
name: Automatically update README, CRDs and CHANGELOG
permissions:
contents: write
outputs:
Expand All @@ -109,6 +109,40 @@ jobs:
run: |
git config user.name "Bitnami Containers"
git config user.email "bitnami-bot@vmware.com"
# In order to avoid doing a full clone (which would fetch the index branch), we
# unshallow the clone only using the main branch. We need to get the tags to
# regenerate the changelog too
- name: Unshallow main branch and get tags
run: |
git fetch origin main --unshallow
git fetch --tags
- name: Install conventional-changelog-cli
run: npm install -g conventional-changelog-cli
- id: generate-changelog
name: Generate changelog
env:
CHART: ${{ needs.get-chart.outputs.chart }}
run: |
# The generator needs the file to exist
chart_version="$(yq e '.version' bitnami/${CHART}/Chart.yaml)"
changelog_file="bitnami/${CHART}/CHANGELOG.md"
changelog_tmp="bitnami/${CHART}/CHANGELOG.md.tmp"
touch "$changelog_file"
npx conventional-changelog-cli -i ${changelog_file} -s -t ${CHART}/ -r 0 --commit-path bitnami/${CHART}
# Remove unreleased section (includes all intermediate commits in the branch) and create future entry based on PR title
# The unreleased section looks like this "## (YYYY-MM-DD)" whereas a released section looks like this "## 0.0.1 (YYYY-MM-DD)"
# So we only need to find a released section to start printing in the awk script below
awk '/^##[^(]*[0-9]/ {flag=1} flag {print}' ${changelog_file} > ${changelog_tmp}
# Remove extra newlines so the changelog file passes the markdown linter
sed -i -E -e '/^$/d' ${changelog_tmp} && sed -i -E -e 's/(##.*)/\n\1\n/g' ${changelog_tmp}
# Include h1 heading and add entry for the current version. There is no tag for the current version (this will be created once merged), so we need to manually add it.
# We know the final squashed commit title, which will be the PR title. We cannot add a link to the commit in the main branch because it has not been
# merged yet (this will be corrected once a new version regenerates the changelog). Instead, we add the PR url which contains the exact same information.
echo -e -n "# Changelog\n\n## $chart_version ($(date +'%Y-%m-%d'))\n\n* ${{ github.event.pull_request.title }} ([#${{ github.event.number }}](${{ github.server_url }}/${{ github.repository }}/pulls/${{ github.event.number }}))\n" > ${changelog_file}
mv ${changelog_tmp} ${changelog_file}
if git status -s | grep "bitnami/${CHART}/CHANGELOG.md"; then
git add "bitnami/${CHART}/CHANGELOG.md" && git commit -m "Update CHANGELOG.md" --signoff
fi
- name: Install readme-generator-for-helm
if: needs.get-chart.outputs.values-updated == 'true'
run: npm install -g @bitnami/readme-generator-for-helm
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/markdown-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- main
paths:
- '**.md'
- '!**/CHANGELOG.md'
# Remove all permissions by default
permissions: {}
jobs:
Expand Down
2 changes: 2 additions & 0 deletions bitnami/airflow/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/apache/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/apisix/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/appsmith/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/argo-cd/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
.vscode/
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/argo-workflows/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
.vscode/
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/aspnet-core/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/cassandra/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/cert-manager/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/clickhouse/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/common/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
.vscode/
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/concourse/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/consul/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/contour/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
.vscode/
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/deepspeed/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/discourse/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
.vscode/
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/dokuwiki/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/drupal/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/ejbca/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/elasticsearch/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/etcd/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/external-dns/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/flink/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/fluent-bit/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/fluentd/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/flux/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/ghost/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/gitea/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/grafana-loki/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/grafana-mimir/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/grafana-operator/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/grafana-tempo/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/grafana/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/haproxy/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/harbor/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/influxdb/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/jaeger/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/janusgraph/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
.project
.idea/
*.tmproj
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/jenkins/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/joomla/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/jupyterhub/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kafka/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/keycloak/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kiam/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kibana/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kong/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kube-prometheus/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kube-state-metrics/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kubeapps/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
2 changes: 2 additions & 0 deletions bitnami/kuberay/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
Loading
Loading