feat(helm)!: Update snapshot-controller ( 3.0.6 → 4.0.0 ) #596
Workflow file for this run
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
--- | |
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: "Flux Helm Repository Sync" | |
on: | |
workflow_dispatch: | |
inputs: | |
clusterName: | |
description: Cluster Name | |
default: heavy-cluster | |
required: true | |
helmRepoNamespace: | |
description: Helm Repository Namespace | |
default: flux-system | |
required: true | |
helmRepoName: | |
description: Helm Repository Name | |
required: true | |
pull_request: | |
branches: ["main"] | |
paths: ["kubernetes/**/helmrelease.yaml"] | |
jobs: | |
sync: | |
name: Flux Helm Repository Sync | |
runs-on: ["gha-runner-scale-set"] | |
steps: | |
- name: Generate Token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: "${{ secrets.BOT_APP_ID }}" | |
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: "${{ steps.app-token.outputs.token }}" | |
fetch-depth: 0 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Workflow Tools | |
shell: bash | |
run: brew install fluxcd/tap/flux yq | |
- name: Write kubeconfig | |
id: kubeconfig | |
uses: timheuer/base64-to-file@v1 | |
with: | |
encodedString: "${{ secrets.KUBECONFIG }}" | |
fileName: kubeconfig | |
- name: Get Changed Files | |
if: ${{ github.event.inputs.clusterName == '' && github.event.inputs.helmRepoNamespace == '' && github.event.inputs.helmRepoName == '' }} | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: kubernetes/**/helmrelease.yaml | |
safe_output: false | |
- name: List All Changed Files | |
if: ${{ github.event.inputs.clusterName == '' && github.event.inputs.helmRepoNamespace == '' && github.event.inputs.helmRepoName == '' }} | |
run: echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | |
- name: Sync Helm Repository from Changed Files | |
if: ${{ github.event.inputs.clusterName == '' && github.event.inputs.helmRepoNamespace == '' && github.event.inputs.helmRepoName == '' }} | |
env: | |
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}" | |
shell: bash | |
run: | | |
for f in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do | |
repo_namespace="$(yq -r '.spec.chart.spec.sourceRef.namespace' "${f}")" | |
repo_name="$(yq -r '.spec.chart.spec.sourceRef.name' "${f}")" | |
flux \ | |
--context admin@heavy-cluster \ | |
--namespace ${repo_namespace} \ | |
reconcile source helm ${repo_name} | |
done | |
- name: Sync Helm Repository with Inputs | |
if: ${{ github.event.inputs.clusterName != '' && github.event.inputs.helmRepoNamespace != '' && github.event.inputs.helmRepoName != '' }} | |
env: | |
KUBECONFIG: ${{ steps.kubeconfig.outputs.filePath }} | |
shell: bash | |
run: | | |
flux \ | |
--context admin@heavy-cluster \ | |
--namespace ${{ github.event.inputs.helmRepoNamespace }} \ | |
reconcile source helm ${{ github.event.inputs.helmRepoName }} |