Skip to content

Commit

Permalink
fix: workflow failure updating downstream helm charts (#398)
Browse files Browse the repository at this point in the history
* fix workflow failure

* update refs & outputs

* prom export version

* fix output ref

* remove unneccessary env refs

---------

Co-authored-by: jamie zieziula <[email protected]>
  • Loading branch information
jamiezieziula and jamie zieziula authored Oct 9, 2024
1 parent b3efa68 commit 2f2bdf5
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 85 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/deploy-latest-helm-version.yaml

This file was deleted.

59 changes: 29 additions & 30 deletions .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
permissions:
# GitHub considers creating releases and uploading assets as writing contents.
contents: write
outputs:
releaseVersion: ${{ steps.output_version.outputs.releaseVersion }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -28,11 +30,16 @@ jobs:
# Enable pipefail so git command failures do not result in null versions downstream
set -x
echo "RELEASE_VERSION=$(date +'%Y.%-m.%-d%H%M%S')" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$(date +'%Y.%-m.%-d%H%M%S')" >> $GITHUB_ENV
echo "PREFECT_VERSION=$(\
git ls-remote --tags --refs --sort="v:refname" \
https://github.com/PrefectHQ/prefect.git '[3].*.[!rc]' | tail -n1 | sed 's/.*\///' \
)" >> $GITHUB_OUTPUT
)" >> $GITHUB_ENV
- name: Output version as GitHub Output
id: output_version
run: |
echo "releaseVersion=$RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: Copy Artifact Hub metadata
run: |
Expand All @@ -55,11 +62,11 @@ jobs:
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "SIGN_KEYRING=$keyring" >> "$GITHUB_ENV"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> $GITHUB_ENV
echo "SIGN_KEYRING=$keyring" >> $GITHUB_ENV
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
GPG_KEYRING_BASE64: ${{ secrets.GPG_KEYRING_BASE64 }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Add dependency chart repos
run: |
Expand All @@ -79,11 +86,6 @@ jobs:
--sign --key '[email protected]' \
--keyring $SIGN_KEYRING \
--passphrase-file $SIGN_PASSPHRASE_FILE
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
PREFECT_VERSION: ${{ steps.get_version.outputs.PREFECT_VERSION }}
SIGN_KEYRING: ${{ env.SIGN_KEYRING }}
SIGN_PASSPHRASE_FILE: ${{ env.SIGN_PASSPHRASE_FILE }}
- name: Package Server helm chart
run: |
Expand All @@ -99,11 +101,6 @@ jobs:
--sign --key '[email protected]' \
--keyring $SIGN_KEYRING \
--passphrase-file $SIGN_PASSPHRASE_FILE
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
PREFECT_VERSION: ${{ steps.get_version.outputs.PREFECT_VERSION }}
SIGN_KEYRING: ${{ env.SIGN_KEYRING }}
SIGN_PASSPHRASE_FILE: ${{ env.SIGN_PASSPHRASE_FILE }}
- name: Update chart index
run: |
Expand All @@ -120,17 +117,6 @@ jobs:
git add ./artifacthub-repo.yml ./index.yaml ./charts/prefect-server-$RELEASE_VERSION.* ./charts/prefect-worker-$RELEASE_VERSION.*
git commit -m "Release $RELEASE_VERSION"
git push origin gh-pages
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}

- name: Trigger deploy-latest-helm-version workflow
run: |
gh workflow run deploy-latest-helm-version.yaml \
--ref main \
-f release_version=$RELEASE_VERSION
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
- name: Create Github Release + Tag
run: |
Expand All @@ -139,6 +125,19 @@ jobs:
--notes "Packaged with Prefect version \
[$PREFECT_VERSION](https://github.com/PrefectHQ/prefect/releases/tag/$PREFECT_VERSION)"
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
PREFECT_VERSION: ${{ steps.get_version.outputs.PREFECT_VERSION }}
GH_TOKEN: ${{ github.token }}

update_helm_chart_versions_downstream:
name: Update Helm Chart versions in `ops-cluster-deployment`
needs: release
runs-on: ubuntu-latest
steps:
- name: Run workflow
run: |
gh workflow run update-prefect-helm-chart-versions.yaml \
--repo prefecthq/ops-cluster-deployment \
--ref main \
-f chart_version=${{ needs.release.outputs.releaseVersion }} \
-f type=main
env:
GH_TOKEN: ${{ secrets.OPS_CLUSTER_DEPLOYMENT_ACTIONS_RW }}
1 change: 0 additions & 1 deletion .github/workflows/notify-on-failure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: Notify on Failure
"on":
workflow_run:
workflows:
- Deploy Latest Helm Releases to Internal Cluster
- Release Prefect Server and Worker Helm Charts
- Release Prometheus Prefect Exporter Helm Chart
- Updatecli Major Dependency Updates
Expand Down
53 changes: 28 additions & 25 deletions .github/workflows/prometheus-exporter-helm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
permissions:
# GitHub considers creating releases and uploading assets as writing contents.
contents: write
outputs:
releaseVersion: ${{ steps.output_version.outputs.releaseVersion }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -28,13 +30,17 @@ jobs:
# Enable pipefail so git command failures do not result in null versions downstream
set -x
echo "CHART_VERSION=$(date +'%Y.%-m.%-d%H%M%S')" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=prometheus-prefect-exporter-$(date +'%Y.%-m.%-d%H%M%S')" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$(date +'%Y.%-m.%-d%H%M%S')" >> $GITHUB_ENV
echo "PROMETHEUS_PREFECT_EXPORTER_VERSION=$(\
git ls-remote --tags --refs --sort="v:refname" \
https://github.com/PrefectHQ/prometheus-prefect-exporter | tail -n1 | sed 's/.*\///' \
)" >> $GITHUB_OUTPUT
- name: Output version as GitHub Output
id: output_version
run: |
echo "releaseVersion=$RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: Copy Artifact Hub metadata
run: |
mkdir -p /tmp/chart
Expand All @@ -56,11 +62,11 @@ jobs:
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "SIGN_KEYRING=$keyring" >> "$GITHUB_ENV"
echo "SIGN_PASSPHRASE_FILE=$passphrase_file" >> $GITHUB_ENV
echo "SIGN_KEYRING=$keyring" >> $GITHUB_ENV
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
GPG_KEYRING_BASE64: ${{ secrets.GPG_KEYRING_BASE64 }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Package Prometheus Exporter helm chart
run: |
Expand All @@ -76,11 +82,6 @@ jobs:
--sign --key '[email protected]' \
--keyring $SIGN_KEYRING \
--passphrase-file $SIGN_PASSPHRASE_FILE
env:
CHART_VERSION: ${{ steps.get_version.outputs.CHART_VERSION }}
PROMETHEUS_PREFECT_EXPORTER_VERSION: ${{ steps.get_version.outputs.PROMETHEUS_PREFECT_EXPORTER_VERSION }}
SIGN_KEYRING: ${{ env.SIGN_KEYRING }}
SIGN_PASSPHRASE_FILE: ${{ env.SIGN_PASSPHRASE_FILE }}
- name: Update chart index
run: |
Expand All @@ -96,17 +97,6 @@ jobs:
git add ./artifacthub-repo.yml ./index.yaml ./charts/prometheus-prefect-exporter-$CHART_VERSION.*
git commit -m "Release $CHART_VERSION"
git push origin gh-pages
env:
CHART_VERSION: ${{ steps.get_version.outputs.CHART_VERSION }}

- name: Trigger deploy-latest-helm-version workflow
run: |
gh workflow run deploy-latest-helm-version.yaml \
--ref main \
-f release_version=$RELEASE_VERSION
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
- name: Create Github Release + Tag
run: |
Expand All @@ -115,6 +105,19 @@ jobs:
--notes "Packaged with Prometheus Prefect Exporter version \
[$PROMETHEUS_PREFECT_EXPORTER_VERSION](https://github.com/PrefectHQ/prometheus-prefect-exporter/releases/tag/$PROMETHEUS_PREFECT_EXPORTER_VERSION)"
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ steps.get_version.outputs.RELEASE_VERSION }}
PROMETHEUS_PREFECT_EXPORTER_VERSION: ${{ steps.get_version.outputs.PROMETHEUS_PREFECT_EXPORTER_VERSION }}
GH_TOKEN: ${{ github.token }}

update_helm_chart_version_downstream:
name: Update Helm Chart version in `ops-cluster-deployment`
needs: release
runs-on: ubuntu-latest
steps:
- name: Run workflow
run: |
gh workflow run update-prefect-helm-chart-versions.yaml \
--repo prefecthq/ops-cluster-deployment \
--ref main \
-f chart_version=${{ needs.release.outputs.releaseVersion }} \
-f type=exporter
env:
GH_TOKEN: ${{ secrets.OPS_CLUSTER_DEPLOYMENT_ACTIONS_RW }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ repos:
hooks:
- id: yamllint
args:
- --strict
- --strict

0 comments on commit 2f2bdf5

Please sign in to comment.