helmfile diff on rc1staging - edffc94fb1f191145786e8e89241efe47eebdd2a #151
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
--- | |
name: 'Deploy Helm Chart' | |
run-name: 'helmfile ${{ github.event.inputs.action }} on ${{ github.event.inputs.deployment }} - ${{ github.sha }}' | |
on: | |
workflow_dispatch: | |
inputs: | |
deployment: | |
description: 'Environment to deploy to' | |
required: true | |
type: choice | |
options: | |
- rc1staging | |
- alfajores2 | |
- alfajores3 | |
- baklava2 | |
- baklava3 | |
- cannoli | |
- rc11 | |
- rc13 | |
action: | |
description: 'Action to run in the workflow' | |
required: true | |
type: choice | |
options: | |
- diff | |
- apply | |
use-branch-commit: | |
description: 'Select to use the commit of the branch as the container image tag' | |
required: true | |
type: boolean | |
default: false | |
change-cause: | |
description: 'The change cause to use for the deployment' | |
required: false | |
type: string | |
jobs: | |
set-config: | |
runs-on: ubuntu-latest | |
outputs: | |
change-cause: ${{ steps.set-config.outputs.change-cause }} | |
cluster: ${{ steps.set-config.outputs.cluster }} | |
image-commit: ${{ steps.set-config.outputs.image-commit }} | |
project: ${{ steps.set-config.outputs.project }} | |
cluster-location: ${{ steps.set-config.outputs.cluster-location }} | |
service-account: ${{ steps.set-config.outputs.service-account }} | |
steps: | |
- id: set-config | |
run: | | |
# SERVICE_ACCOUNT_SUFFIX="-ro" | |
SERVICE_ACCOUNT_SUFFIX="" | |
[ "${{ github.ref_name }}" == master ] && SERVICE_ACCOUNT_SUFFIX="" | |
if [ "${{ github.event.inputs.action }}" == apply ] && [ "${{ github.event.inputs.deployment }}" != rc1staging ] && [ "${{ github.ref_name }}" != master ]; then | |
echo "ERROR: Only the master branch can be deployed to non-rc1staging environments" | |
exit 1 | |
fi | |
if [ "${{ github.event.inputs.deployment }}" == "cannoli" ]; then | |
echo "cluster=cannoli" >> "$GITHUB_OUTPUT" | |
echo "project=cannoli-380909" >> "$GITHUB_OUTPUT" | |
echo "cluster-location=us-west1-a" >> "$GITHUB_OUTPUT" | |
echo "service-account=deploy-helm-cannoli${SERVICE_ACCOUNT_SUFFIX}@cannoli-380909.iam.gserviceaccount.com" >> "$GITHUB_OUTPUT" | |
elif [ "${{ github.event.inputs.deployment }}" == "rc1staging" ]; then | |
echo "cluster=rc1staging" >> "$GITHUB_OUTPUT" | |
echo "project=celo-testnet-production" >> "$GITHUB_OUTPUT" | |
echo "cluster-location=us-west1-a" >> "$GITHUB_OUTPUT" | |
echo "service-account=deploy-helm-celo-prod${SERVICE_ACCOUNT_SUFFIX}@celo-testnet-production.iam.gserviceaccount.com" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ github.event.inputs.deployment }}" =~ ^alfajores[2-3]$ ]]; then | |
echo "cluster=alfajores" >> "$GITHUB_OUTPUT" | |
echo "project=celo-testnet-production" >> "$GITHUB_OUTPUT" | |
echo "cluster-location=us-west1-a" >> "$GITHUB_OUTPUT" | |
echo "service-account=deploy-helm-celo-prod${SERVICE_ACCOUNT_SUFFIX}@celo-testnet-production.iam.gserviceaccount.com" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ github.event.inputs.deployment }}" =~ ^baklava[2-3]$ ]]; then | |
echo "cluster=baklavastaging" >> "$GITHUB_OUTPUT" | |
echo "project=celo-testnet-production" >> "$GITHUB_OUTPUT" | |
echo "cluster-location=us-west1-a" >> "$GITHUB_OUTPUT" | |
echo "service-account=deploy-helm-celo-prod${SERVICE_ACCOUNT_SUFFIX}@celo-testnet-production.iam.gserviceaccount.com" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ github.event.inputs.deployment }}" =~ ^rc1[1|3]$ ]]; then | |
echo "cluster=mainnet" >> "$GITHUB_OUTPUT" | |
echo "project=celo-testnet-production" >> "$GITHUB_OUTPUT" | |
echo "cluster-location=us-west1-a" >> "$GITHUB_OUTPUT" | |
echo "service-account=deploy-helm-celo-prod${SERVICE_ACCOUNT_SUFFIX}@celo-testnet-production.iam.gserviceaccount.com" >> "$GITHUB_OUTPUT" | |
fi | |
if [ -z "${{ github.event.inputs.change-cause }}" ]; then | |
echo "change-cause=\"Deployment ${{ github.sha }} triggered by ${{ github.triggering_actor }} on ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"" >> "$GITHUB_OUTPUT" | |
else | |
echo "change-cause=\"${{ github.event.inputs.change-cause }}\"" >> "$GITHUB_OUTPUT" | |
fi | |
if [ "${{ github.event.inputs.use-branch-commit }}" == "true" ]; then | |
echo "image-commit=${{ github.sha }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "image-commit=" >> "$GITHUB_OUTPUT" | |
fi | |
helmfile-run: | |
uses: ./.github/workflows/helm_deploy_call.yml | |
needs: set-config | |
name: "helmfile ${{ github.event.inputs.action }}" | |
with: | |
helmfile: helm/helmfiles/${{ github.event.inputs.deployment }}.yaml | |
action: ${{ github.event.inputs.action }} | |
image-commit: ${{ needs.set-config.outputs.image-commit }} | |
change-cause: ${{ needs.set-config.outputs.change-cause }} | |
cluster-name: ${{ needs.set-config.outputs.cluster }} | |
cluster-location: ${{ needs.set-config.outputs.cluster-location }} | |
project: ${{ needs.set-config.outputs.project }} | |
service-account: ${{ needs.set-config.outputs.service-account }} |