Skip to content

Commit

Permalink
Create pull request for adding helm index to main branch (#2086)
Browse files Browse the repository at this point in the history
* Update manifest generation

* Add gh action for create pull request for adding helm index to main branch

* Add gh action for create pull request for adding helm index to main branch

* Add gh action for create pull request for adding helm index to main branch

* fixup quotest

* fixup!

* fixup!

* fixup!

---------

Co-authored-by: Gabriel Krenn <[email protected]>
  • Loading branch information
andriisoldatenko and gkrenn authored Sep 12, 2023
1 parent 980c54c commit c99fa05
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
26 changes: 25 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ jobs:
environment: Release
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -319,7 +320,30 @@ jobs:
prerelease: false
draft: true
fail_on_unmatched_files: true

- name: Update index helm file
uses: actions/checkout@v3
run: |
echo "Updating Helm repo index"
./hack/build/ci/generate-new-helm-index-yaml.sh
- name: Create pull request for adding helm index to main branch
uses: peter-evans/create-pull-request@v5
with:
base: main
delete-branch: true
add-paths: |
./config/helm/repos/stable/index.yaml
./config/helm/repos/stable/index.yaml.previous
title: '[Automatic] Update index for ${{ github.ref }} release'
commit-message: Update index.yaml
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: |
# Description
Upgrade `index.yaml` to include latest version of the helm chart.
## How can this be tested?
Helm upgrade to and install of `${{ github.ref }}` works.
## Checklist
- [x] PR is labeled accordingly
snyk:
name: Push tag to snyk
environment: Release
Expand Down
29 changes: 29 additions & 0 deletions hack/build/ci/generate-new-helm-index-yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

if [ -z "$2" ]
then
echo "Usage: $0 <output-dir> <version_without_prefix>"
exit 1
fi

readonly output_dir="${1}"
readonly version_without_prefix="${2}"

cleanup() {
echo "cleanup"
}

trap 'cleanup' ERR

cp "config/helm/repos/stable/index.yaml" "config/helm/repos/stable/index.yaml.previous"

helm repo index "${output_dir}" \
--url "https://github.com/Dynatrace/dynatrace-operator/releases/download/v${version_without_prefix}" \
--merge "./config/helm/repos/stable/index.yaml"

mv -v "${output_dir}"/index.yaml ./config/helm/repos/stable/index.yaml

# Fix quotes in place to minimize the diff
sed -i'' -e "s/\"/'/g" ./config/helm/repos/stable/index.yaml

rm -rf "${output_dir}"

0 comments on commit c99fa05

Please sign in to comment.