From 169c0d992c459463ac3580c764495d9ba168d723 Mon Sep 17 00:00:00 2001 From: Serhii Varakuta Date: Tue, 9 Jul 2024 18:29:34 +0300 Subject: [PATCH] Fix redeployment --- .github/actions/deploy/action.yml | 3 +++ .github/workflows/live.yml | 1 + operations/deploy-live.hcl | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml index 3d037e1..4f48ca0 100644 --- a/.github/actions/deploy/action.yml +++ b/.github/actions/deploy/action.yml @@ -10,6 +10,8 @@ inputs: required: true deploy-sha: required: true + deploy-nonce: + required: true runs: using: "composite" @@ -22,6 +24,7 @@ runs: NOMAD_ADDR: ${{ inputs.nomad-addr }} run: | sed -i 's/DEPLOY_SHA/${{ inputs.deploy-sha }}/g' operations/deploy-${{ inputs.environment }}.hcl + sed -i 's/DEPLOY_NONCE/${{ inputs.deploy-nonce }}/g' operations/deploy-${{ inputs.environment }}.hcl curl -L https://releases.hashicorp.com/nomad/1.6.3/nomad_1.6.3_linux_amd64.zip -o nomad.zip unzip nomad.zip ./nomad job run operations/deploy-${{ inputs.environment }}.hcl diff --git a/.github/workflows/live.yml b/.github/workflows/live.yml index 95f8d18..b2835f4 100644 --- a/.github/workflows/live.yml +++ b/.github/workflows/live.yml @@ -32,3 +32,4 @@ jobs: nomad-token: ${{ secrets.NOMAD_TOKEN_DEPLOY }} nomad-addr: ${{ secrets.NOMAD_DEPLOY_ADDR }} deploy-sha: ${{ github.sha }} + deploy-nonce: ${{ github.run_id }}-${{ github.run_attempt }} diff --git a/operations/deploy-live.hcl b/operations/deploy-live.hcl index ba75268..0434237 100644 --- a/operations/deploy-live.hcl +++ b/operations/deploy-live.hcl @@ -22,7 +22,7 @@ job "depictor-live" { driver = "docker" config { - image = "svforte/depictor:latest" + image = "svforte/depictor:DEPLOY_SHA" force_pull = true ports = ["nginx-http"] } @@ -36,7 +36,7 @@ job "depictor-live" { name = "depictor-nginx" port = "nginx-http" tags = [ - "deploy_sha=DEPLOY_SHA", + "deploy_nonce=DEPLOY_NONCE", "traefik.enable=true", "traefik.http.routers.depictor.entrypoints=https", "traefik.http.routers.depictor.rule=Host(`netowork-health.dmz.ator.dev`)",