-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2178 from keboola/michal-fix-kbc-stacks-trigger
fix: Use kbc-stacks trigger locally
- Loading branch information
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Trigger image tag update | ||
description: 'Trigger image tag update workflow' | ||
inputs: | ||
helm-chart: | ||
description: "The Helm chart to update" | ||
required: true | ||
image-tag: | ||
description: "The image tag to update to" | ||
required: true | ||
automerge: | ||
description: "Automatically merge PRs" | ||
required: false | ||
default: 'true' | ||
dry-run: | ||
description: "Do a dry run" | ||
required: false | ||
default: 'false' | ||
github-app-private-key: | ||
description: 'The "Keboola - kbc-stacks trigger" GitHub App private key' | ||
required: true | ||
|
||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Generate a token | ||
id: app-token | ||
uses: actions/[email protected] | ||
with: | ||
app-id: "1032801" | ||
private-key: ${{ inputs.github-app-private-key }} | ||
owner: ${{ github.repository_owner }} | ||
repositories: "kbc-stacks" | ||
- name: Trigger image tag update | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
unset GITHUB_TOKEN | ||
# Create metadata JSON with source information | ||
METADATA=$(cat <<EOF | ||
{ | ||
"source": { | ||
"repository": "$GITHUB_REPOSITORY", | ||
"repository_url": "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY", | ||
"sha": "$GITHUB_SHA", | ||
"actor": "$GITHUB_ACTOR", | ||
"workflow_url": "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID", | ||
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" | ||
} | ||
} | ||
EOF | ||
) | ||
# Encode metadata to base64 | ||
ENCODED_METADATA=$(echo "$METADATA" | base64 -w 0) | ||
gh workflow run update-image-tag.yaml \ | ||
-R keboola/kbc-stacks \ | ||
-r main \ | ||
-f helm-chart=${{ inputs.helm-chart }} \ | ||
-f image-tag=${{ inputs.image-tag }} \ | ||
-f automerge=${{ inputs.automerge }} \ | ||
-f dry-run=${{ inputs.dry-run }} \ | ||
-f metadata="$ENCODED_METADATA" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters