Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: release helm scripts updated to be automatic

Daniel Hougaard778b0d436894
diff --git a/.github/workflows/release-k8-operator-helm.yml b/.github/workflows/release-k8-operator-helm.yml
new file mode 100644
index 0000000000..f3731fb46c
--- /dev/null
+++ b/.github/workflows/release-k8-operator-helm.yml
@@ -0,0 +1,27 @@
+name: Release K8 Operator Helm Chart
+on:
+ workflow_dispatch:
+
+jobs:
+ release-helm:
+ name: Release Helm Chart
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Install Helm
+ uses: azure/setup-helm@v3
+ with:
+ version: v3.10.0
+
+ - name: Install python
+ uses: actions/setup-python@v4
+
+ - name: Install Cloudsmith CLI
+ run: pip install --upgrade cloudsmith-cli
+
+ - name: Build and push helm package to CloudSmith
+ run: cd helm-charts && sh upload-k8s-operator-cloudsmith.sh
+ env:
+ CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
diff --git a/.github/workflows/release_docker_k8_operator.yaml b/.github/workflows/release_docker_k8_operator.yaml
index 162cc9dc0b..4af62df1c9 100644
--- a/.github/workflows/release_docker_k8_operator.yaml
+++ b/.github/workflows/release_docker_k8_operator.yaml
@@ -1,52 +1,103 @@
-name: Release image + Helm chart K8s Operator
+name: Release K8 Operator Docker Image
on:
- push:
- tags:
- - "infisical-k8-operator/v*.*.*"
+ push:
+ tags:
+ - "infisical-k8-operator/v*.*.*"
jobs:
- release:
- runs-on: ubuntu-latest
- steps:
- - name: Extract version from tag
- id: extract_version
- run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-k8-operator/}"
- - uses: actions/checkout@v2
-
- - name: πŸ”§ Set up QEMU
- uses: docker/setup-qemu-action@v1
-
- - name: πŸ”§ Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
-
- - name: πŸ‹ Login to Docker Hub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- - name: Build and push
- id: docker_build
- uses: docker/build-push-action@v2
- with:
- context: k8-operator
- push: true
- platforms: linux/amd64,linux/arm64
- tags: |
- infisical/kubernetes-operator:latest
- infisical/kubernetes-operator:${{ steps.extract_version.outputs.version }}
-
- - name: Checkout
- uses: actions/checkout@v2
- - name: Install Helm
- uses: azure/setup-helm@v3
- with:
- version: v3.10.0
- - name: Install python
- uses: actions/setup-python@v4
- - name: Install Cloudsmith CLI
- run: pip install --upgrade cloudsmith-cli
- - name: Build and push helm package to Cloudsmith
- run: cd helm-charts && sh upload-k8s-operator-cloudsmith.sh
- env:
- CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
+ release-image:
+ name: Generate Helm Chart PR
+ runs-on: ubuntu-latest
+ outputs:
+ pr_number: ${{ steps.create-pr.outputs.pull-request-number }}
+ steps:
+ - name: Extract version from tag
+ id: extract_version
+ run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-k8-operator/}"
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ # Dependency for helm generation
+ - name: Install Helm
+ uses: azure/setup-helm@v3
+ with:
+ version: v3.10.0
+
+ # Dependency for helm generation
+ - name: Install Go
+ uses: actions/setup-go@v4
+ with:
+ go-version: 1.21
+
+ # Install binaries for helm generation
+ - name: Install dependencies
+ working-directory: k8-operator
+ run: |
+ make helmify
+ make kustomize
+ make controller-gen
+
+ - name: Generate Helm Chart
+ working-directory: k8-operator
+ run: make helm
+
+ - name: Update Helm Chart Version
+ run: ./k8-operator/scripts/update-version.sh ${{ steps.extract_version.outputs.version }}
+
+ - name: Debug - Check file changes
+ run: |
+ echo "Current git status:"
+ git status
+ echo ""
+ echo "Modified files:"
+ git diff --name-only
+
+ # If there is no diff, exit with error. Version should always be changed, so if there is no diff, something is wrong and we should exit.
+ if [ -z "$(git diff --name-only)" ]; then
+ echo "No helm changes or version changes. Invalid release detected, Exiting."
+ exit 1
+ fi
+
+ - name: Create Helm Chart PR
+ id: create-pr
+ uses: peter-evans/create-pull-request@v5
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ commit-message: "Update Helm chart to version ${{ steps.extract_version.outputs.version }}"
+ committer: GitHub <[email protected]>
+ author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
+ branch: helm-update-${{ steps.extract_version.outputs.version }}
+ delete-branch: true
+ title: "Update Helm chart to version ${{ steps.extract_version.outputs.version }}"
+ body: |
+ This PR updates the Helm chart to version `${{ steps.extract_version.outputs.version }}`.
+ Additionally the helm chart has been updated to match the latest operator code changes.
+
+ Associated Release Workflow: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
+
+ Once you have approved this PR, you can trigger the helm release workflow manually.
+ base: main
+
+ - name: πŸ”§ Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: πŸ”§ Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: πŸ‹ Login to Docker Hub
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Build and push
+ id: docker_build
+ uses: docker/build-push-action@v2
+ with:
+ context: k8-operator
+ push: true
+ platforms: linux/amd64,linux/arm64
+ tags: |
+ infisical/kubernetes-operator:latest
+ infisical/kubernetes-operator:${{ steps.extract_version.outputs.version }}