From 0dcdb50c73e6d0f95259f549159559d015e2c806 Mon Sep 17 00:00:00 2001 From: Hans Song Date: Mon, 15 Apr 2024 23:27:33 +1000 Subject: [PATCH] use helm in deployment, use checksum --- .github/workflows/_deploy.yml | 19 ++++++++++--------- .github/workflows/push-to-master.yml | 8 +++++--- charts/huisheng/Chart.yaml | 2 +- charts/huisheng/templates/deployment.yaml | 2 ++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/_deploy.yml b/.github/workflows/_deploy.yml index 4012cb0..db1f5ec 100644 --- a/.github/workflows/_deploy.yml +++ b/.github/workflows/_deploy.yml @@ -11,9 +11,6 @@ on: NEW_RELIC_DEPLOYMENT_ENTITY_GUID: required: true -env: - STATUS_COLOR: 255 - jobs: notify: runs-on: self-hosted @@ -30,13 +27,17 @@ jobs: environment: production steps: - - name: Rollout deployment - uses: axatol/actions/rollout-kubernetes-deployment@release + - name: Upgrade helm chart id: deploy - with: - deployment-name: huisheng - namespace: huisheng - wait: true + run: | + helm repo add huisheng https://huisheng.charts.axatol.xyz + helm repo update + helm upgrade huisheng huisheng/huisheng \ + --install \ + --create-namespace \ + --namespace huisheng \ + --atomic \ + --reuse-values - name: Create deployment marker if: success() diff --git a/.github/workflows/push-to-master.yml b/.github/workflows/push-to-master.yml index b902af4..60c27b3 100644 --- a/.github/workflows/push-to-master.yml +++ b/.github/workflows/push-to-master.yml @@ -11,11 +11,13 @@ on: workflow_dispatch: jobs: - build-image: + build: uses: ./.github/workflows/_build.yml + with: + publish: true - restart-deployment: - needs: build-image + deploy: + needs: build uses: ./.github/workflows/_deploy.yml secrets: DISCORD_GITHUB_ACTIONS_WEBHOOK_URL: ${{ secrets.DISCORD_GITHUB_ACTIONS_WEBHOOK_URL }} diff --git a/charts/huisheng/Chart.yaml b/charts/huisheng/Chart.yaml index ebd173f..51af550 100644 --- a/charts/huisheng/Chart.yaml +++ b/charts/huisheng/Chart.yaml @@ -3,7 +3,7 @@ name: huisheng description: Huisheng type: application -version: 0.0.2 +version: 0.0.3 appVersion: 0.0.1 home: https://github.com/hans-m-song/huisheng diff --git a/charts/huisheng/templates/deployment.yaml b/charts/huisheng/templates/deployment.yaml index 37f99a4..e760abb 100644 --- a/charts/huisheng/templates/deployment.yaml +++ b/charts/huisheng/templates/deployment.yaml @@ -14,6 +14,8 @@ spec: template: metadata: labels: {{ include "huisheng.selectorLabels" . | nindent 8 }} + annotations: + credentials/checksum: {{ include (print $.Template.BasePath "/credentials.yaml") . | sha256sum }} spec: containers: - name: huisheng