From eb1de9013f6564f2049132612d1b33f98184c530 Mon Sep 17 00:00:00 2001 From: bobjwalker Date: Fri, 9 Feb 2024 17:03:57 -0600 Subject: [PATCH 1/4] Removing script and using conditionals instead --- .github/workflows/build.yml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7bce98e..34b497e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,25 +39,6 @@ jobs: tag_name: ${{ steps.determine_version.outputs.semVer }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - id: EnvOverlay - name: Set Release Number - run: | - $branchName = (((${env:GITHUB_REF} -replace "refs/heads/", "") -replace "feature/", "") -replace "bugfix/", "") -replace " ", "" - Write-Host "The Branch Name is: $branchName" - - $environmentName = "test" - Write-Host "The environment name is now $environmentName" - - if ($branchName -ne "main") - { - Write-Host "The branch is not the main branch, using the feature branch settings instead." - - $environmentName = "dev" - } - - Write-Host "Setting the Output Variable KUSTOMIZE_ENVIRONMENT to $environmentName" - Write-Output "KUSTOMIZE_ENVIRONMENT=$environmentName" >> $Env:GITHUB_OUTPUT - shell: pwsh - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -75,7 +56,13 @@ jobs: - name: update dev kustomize uses: mikefarah/yq@master with: - cmd: yq -i '.images.[0].newTag = "${{ steps.determine_version.outputs.semVer }}"' 'k8s/overlays/${{ steps.EnvOverlay.outputs.KUSTOMIZE_ENVIRONMENT }}/kustomization.yaml' + cmd: yq -i '.images.[0].newTag = "${{ steps.determine_version.outputs.semVer }}"' 'k8s/overlays/dev/kustomization.yaml' + if: contains(github.ref, 'feature') + - name: update test kustomize + uses: mikefarah/yq@master + with: + cmd: yq -i '.images.[0].newTag = "${{ steps.determine_version.outputs.semVer }}"' 'k8s/overlays/test/kustomization.yaml' + if: github.ref == 'refs/heads/master' - name: commit the kustomize change uses: devops-infra/action-commit-push@master with: From de4ae56a2965f8fb2d7c45131576cc85fc5e03c6 Mon Sep 17 00:00:00 2001 From: BobJWalker Date: Fri, 9 Feb 2024 23:05:13 +0000 Subject: [PATCH 2/4] Updating the Kustomize overlay to 0.1.51-triggers.1 Files changed: M k8s/overlays/dev/kustomization.yaml --- k8s/overlays/dev/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/overlays/dev/kustomization.yaml b/k8s/overlays/dev/kustomization.yaml index 4b4569b..564a613 100644 --- a/k8s/overlays/dev/kustomization.yaml +++ b/k8s/overlays/dev/kustomization.yaml @@ -10,7 +10,7 @@ secretGenerator: images: - name: bobjwalker99/randomquotes-k8s newName: bobjwalker99/randomquotes-k8s - newTag: "0.1.49-tagging.22" + newTag: "0.1.51-triggers.1" patches: - target: kind: Ingress From 8b7b80d51fc33c4c58649d0e547d26a263f53664 Mon Sep 17 00:00:00 2001 From: bobjwalker Date: Fri, 9 Feb 2024 17:11:00 -0600 Subject: [PATCH 3/4] Different action for updating tags --- .github/workflows/build.yml | 2 +- .github/workflows/deploy-dev-argo.yml | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34b497e..a7bf773 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,7 +63,7 @@ jobs: with: cmd: yq -i '.images.[0].newTag = "${{ steps.determine_version.outputs.semVer }}"' 'k8s/overlays/test/kustomization.yaml' if: github.ref == 'refs/heads/master' - - name: commit the kustomize change + - name: commit the kustomize change for Argo uses: devops-infra/action-commit-push@master with: github_token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/deploy-dev-argo.yml b/.github/workflows/deploy-dev-argo.yml index d81fa5c..9c121b1 100644 --- a/.github/workflows/deploy-dev-argo.yml +++ b/.github/workflows/deploy-dev-argo.yml @@ -10,10 +10,13 @@ on: jobs: update-argo-tag: runs-on: ubuntu-latest - steps: - - name: update tag - uses: richardsimko/update-tag@v1 - with: - tag_name: dev-argo - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: rickstaa/action-create-tag@v1 + id: "tag_create" + with: + tag: "dev-argo" + tag_exists_error: false + force_push_tag: true \ No newline at end of file From b63e57aa5632b587683ee869c3def959f8f8b41d Mon Sep 17 00:00:00 2001 From: BobJWalker Date: Fri, 9 Feb 2024 23:11:58 +0000 Subject: [PATCH 4/4] Updating the Kustomize overlay to 0.1.51-triggers.4 Files changed: M k8s/overlays/dev/kustomization.yaml --- k8s/overlays/dev/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/overlays/dev/kustomization.yaml b/k8s/overlays/dev/kustomization.yaml index 564a613..73db137 100644 --- a/k8s/overlays/dev/kustomization.yaml +++ b/k8s/overlays/dev/kustomization.yaml @@ -10,7 +10,7 @@ secretGenerator: images: - name: bobjwalker99/randomquotes-k8s newName: bobjwalker99/randomquotes-k8s - newTag: "0.1.51-triggers.1" + newTag: "0.1.51-triggers.4" patches: - target: kind: Ingress