From d92a2f8c438c986c2eccbd40a9c036985258ef57 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 09:25:07 +1100 Subject: [PATCH 01/31] config script --- .github/workflows/export_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config.yml b/.github/workflows/export_config.yml index 3402aa56..c1eb7574 100644 --- a/.github/workflows/export_config.yml +++ b/.github/workflows/export_config.yml @@ -38,7 +38,7 @@ jobs: - name: Run export script run: | cd /app - /app/.circleci/export-config.sh + /app/scripts/export-config-push-uat.sh - name: Get the release branch run: | CURRENT_GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" From eb1a9d864d52ca4e0e792df14385a1f7732dba9e Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 09:25:19 +1100 Subject: [PATCH 02/31] config script --- .github/workflows/export_config_push_uat.yml | 62 ++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/export_config_push_uat.yml diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml new file mode 100644 index 00000000..bfc780ef --- /dev/null +++ b/.github/workflows/export_config_push_uat.yml @@ -0,0 +1,62 @@ +name: export_config + +on: + workflow_dispatch: + inputs: + branch_name: + description: "Branch name to export config and push changes (e.g., release/SCFA-1234)" + required: true + type: string + uat_push: + description: "Push to UAT flag" + required: false + default: false + type: boolean + +env: + REGISTRY: ghcr.io + +jobs: + export_config: + name: Export Config and Push to UAT + runs-on: ubuntu-latest + container: + image: ghcr.io/dpc-sdp/bay/ci-builder:5.x + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Log into registry ghcr.io + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Uncomment database snapshot environment variable + run: | + sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env + + - name: Configure Git + run: | + git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" \ + && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" + + - name: Copy repo + run: | + chown -R $(id -u):$(id -g) $PWD + cp -R ${GITHUB_WORKSPACE} /app + + - name: Run export script + run: | + cd /app + bash .circleci/export-config.sh "${{ inputs.branch_name }}" + + - name: Notify completion + if: success() + run: | + echo "Export config completed and pushed to branch ${{ inputs.branch_name }}." From 04abe76da5574208104d10b223af0371671e94fc Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 09:36:35 +1100 Subject: [PATCH 03/31] config script --- .github/workflows/export_config.yml | 2 +- .github/workflows/export_config_push_uat.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/export_config.yml b/.github/workflows/export_config.yml index c1eb7574..3402aa56 100644 --- a/.github/workflows/export_config.yml +++ b/.github/workflows/export_config.yml @@ -38,7 +38,7 @@ jobs: - name: Run export script run: | cd /app - /app/scripts/export-config-push-uat.sh + /app/.circleci/export-config.sh - name: Get the release branch run: | CURRENT_GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index bfc780ef..5e85a1dc 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -54,7 +54,7 @@ jobs: - name: Run export script run: | cd /app - bash .circleci/export-config.sh "${{ inputs.branch_name }}" + bash scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From 00333fe215a82fd1155266a0160842dae9ed73c4 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 12:29:27 +1100 Subject: [PATCH 04/31] oncall --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 5e85a1dc..5e3d63db 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -1,7 +1,7 @@ name: export_config on: - workflow_dispatch: + workflow_call: inputs: branch_name: description: "Branch name to export config and push changes (e.g., release/SCFA-1234)" From 66f3432e23cdf4bbacdea97d7c840b42a96d11d5 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 14:19:35 +1100 Subject: [PATCH 05/31] oncall --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 5e3d63db..dc4166f8 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -19,7 +19,7 @@ env: jobs: export_config: name: Export Config and Push to UAT - runs-on: ubuntu-latest + runs-on: biggy container: image: ghcr.io/dpc-sdp/bay/ci-builder:5.x From 710a8ca0d8c14d62bf4329c648350e8042a67862 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 14:38:55 +1100 Subject: [PATCH 06/31] oncall --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index dc4166f8..65736086 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -46,7 +46,7 @@ jobs: git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" \ && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - - name: Copy repo + - name: Adjust permissions and copy repo run: | chown -R $(id -u):$(id -g) $PWD cp -R ${GITHUB_WORKSPACE} /app From ddacca46623c8d56d58a6e2403bac2f8ed32cbdb Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 15:27:20 +1100 Subject: [PATCH 07/31] oncall --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 65736086..eaed13bd 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -54,7 +54,7 @@ jobs: - name: Run export script run: | cd /app - bash scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + bash scripts/eexport_config_push_uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From dc33dba9fb4008f54c80cebfaf2a7aa4cce0801a Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 15:29:03 +1100 Subject: [PATCH 08/31] oncall --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index eaed13bd..c716676f 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -54,7 +54,7 @@ jobs: - name: Run export script run: | cd /app - bash scripts/eexport_config_push_uat.sh "${{ inputs.branch_name }}" + bash scripts/export_config_push_uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From 73afebcd3baace40c900def71ae0b7a9a9e0a2c8 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 15:48:33 +1100 Subject: [PATCH 09/31] filepath --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index c716676f..b3be8122 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -54,7 +54,7 @@ jobs: - name: Run export script run: | cd /app - bash scripts/export_config_push_uat.sh "${{ inputs.branch_name }}" + bash ./scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From f268123229048358de1944db8ba74414eaf43018 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:17:55 +1100 Subject: [PATCH 10/31] filepath --- .github/workflows/export_config_push_uat.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index b3be8122..a9ffb47e 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -42,19 +42,12 @@ jobs: sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env - name: Configure Git - run: | - git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" \ - && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - - - name: Adjust permissions and copy repo - run: | - chown -R $(id -u):$(id -g) $PWD - cp -R ${GITHUB_WORKSPACE} /app - - - name: Run export script run: | cd /app bash ./scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + env: + DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} + DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} - name: Notify completion if: success() From 4b256c22718c439d07392e2c7942c350e37bb55d Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:27:51 +1100 Subject: [PATCH 11/31] test --- .github/workflows/export_config_push_uat.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index a9ffb47e..6b4ff74f 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -41,13 +41,19 @@ jobs: run: | sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env + - name: Configure Git + run: | + git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" + # GitHub Actions does not support cloning to a custom path. + - name: Copy repo + run: | + chown -R $(id -u):$(id -g) $PWD + cp -R ${GITHUB_WORKSPACE} /app + - name: Run export script run: | cd /app - bash ./scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - env: - DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} - DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} + /app/.scripts/export-config-push-uat.sh - name: Notify completion if: success() From 6095406f6c69c0d53c3a4b8e64c930f9a5371352 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:29:23 +1100 Subject: [PATCH 12/31] test --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 6b4ff74f..3f34849e 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -53,7 +53,7 @@ jobs: - name: Run export script run: | cd /app - /app/.scripts/export-config-push-uat.sh + /app/.circleci/export-config.sh - name: Notify completion if: success() From 1c5b70abf20d7fc8b51f3bd6d41daa72739491ed Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:32:09 +1100 Subject: [PATCH 13/31] test --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 3f34849e..48a7c07d 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -53,7 +53,7 @@ jobs: - name: Run export script run: | cd /app - /app/.circleci/export-config.sh + /app/scripts/export-config-push-uat.sh - name: Notify completion if: success() From 88e618bd2894ec3d7d418b78dcb883ebbc87efe4 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:36:14 +1100 Subject: [PATCH 14/31] test --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 48a7c07d..81704f30 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -53,7 +53,7 @@ jobs: - name: Run export script run: | cd /app - /app/scripts/export-config-push-uat.sh + /app/scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From bb11dab569293bdc80723504294f19668e03d028 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:41:30 +1100 Subject: [PATCH 15/31] test --- .github/workflows/export_config_push_uat.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 81704f30..b4c185ee 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -41,19 +41,22 @@ jobs: run: | sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env - - name: Configure Git run: | git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - # GitHub Actions does not support cloning to a custom path. + - name: Copy repo run: | chown -R $(id -u):$(id -g) $PWD cp -R ${GITHUB_WORKSPACE} /app + - name: Run export script run: | cd /app /app/scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + env: + DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} + DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} - name: Notify completion if: success() From 6a3d01d739357e90b39dfb2762c2f24c53ff61a1 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 17:44:20 +1100 Subject: [PATCH 16/31] test --- .github/workflows/export_config_push_uat.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index b4c185ee..dd999dc5 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -15,6 +15,8 @@ on: env: REGISTRY: ghcr.io + DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} # Passing the secret + DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} # Passing the secret jobs: export_config: @@ -43,7 +45,8 @@ jobs: - name: Configure Git run: | - git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" + git config --global user.email "${{ env.DEPLOY_USER_EMAIL }}" \ + && git config --global user.name "${{ env.DEPLOY_USER_NAME }}" - name: Copy repo run: | @@ -53,10 +56,7 @@ jobs: - name: Run export script run: | cd /app - /app/scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - env: - DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} - DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} + bash scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - name: Notify completion if: success() From b1af2b725af8fbf0f905bfca497e44126d641b07 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 18:11:11 +1100 Subject: [PATCH 17/31] test --- .github/workflows/export_config_push_uat.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index dd999dc5..ee50ac97 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -15,8 +15,6 @@ on: env: REGISTRY: ghcr.io - DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} # Passing the secret - DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} # Passing the secret jobs: export_config: @@ -57,6 +55,9 @@ jobs: run: | cd /app bash scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + env: + DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} + DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} - name: Notify completion if: success() From d1a7faa0017f6982907629082370f53f1cfce9bd Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 18:46:44 +1100 Subject: [PATCH 18/31] test --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index ee50ac97..4fde78ea 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -54,7 +54,7 @@ jobs: - name: Run export script run: | cd /app - bash scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + bash .circleci/export-config.sh "${{ inputs.branch_name }}" env: DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} From d723ff700e581a903eccb0ec4ffde58479f35732 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 18:57:53 +1100 Subject: [PATCH 19/31] test --- .github/workflows/export_config_push_uat.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 4fde78ea..fdf88b2b 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -43,8 +43,7 @@ jobs: - name: Configure Git run: | - git config --global user.email "${{ env.DEPLOY_USER_EMAIL }}" \ - && git config --global user.name "${{ env.DEPLOY_USER_NAME }}" + git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - name: Copy repo run: | @@ -53,8 +52,10 @@ jobs: - name: Run export script run: | + export DEPLOY_USER_EMAIL="${{ secrets.DEPLOY_USER_EMAIL }}" + export DEPLOY_USER_NAME="${{ secrets.DEPLOY_USER_NAME }}" cd /app - bash .circleci/export-config.sh "${{ inputs.branch_name }}" + scripts/export-config.sh "${{ inputs.branch_name }}" env: DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} From 9cd145ab3701a0fd666576f91f52e7d30bd7442e Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 19:31:48 +1100 Subject: [PATCH 20/31] test --- .github/workflows/export_config_push_uat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index fdf88b2b..9daaad58 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -55,7 +55,7 @@ jobs: export DEPLOY_USER_EMAIL="${{ secrets.DEPLOY_USER_EMAIL }}" export DEPLOY_USER_NAME="${{ secrets.DEPLOY_USER_NAME }}" cd /app - scripts/export-config.sh "${{ inputs.branch_name }}" + scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" env: DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} From 2d949244fdcbfb764132abcbcbceacb8b6e203cb Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Wed, 22 Jan 2025 19:53:15 +1100 Subject: [PATCH 21/31] test --- .github/workflows/export_config_push_uat.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index 9daaad58..d115f0c6 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -52,10 +52,10 @@ jobs: - name: Run export script run: | - export DEPLOY_USER_EMAIL="${{ secrets.DEPLOY_USER_EMAIL }}" - export DEPLOY_USER_NAME="${{ secrets.DEPLOY_USER_NAME }}" + echo "==> Using deploy user email: ${{ secrets.DEPLOY_USER_EMAIL }}" + echo "==> Using deploy user name: ${{ secrets.DEPLOY_USER_NAME }}" cd /app - scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" "${{ secrets.DEPLOY_USER_EMAIL }}" "${{ secrets.DEPLOY_USER_NAME }}" env: DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} From 8054697a2b804cc7970969e5477c78fcee4f1584 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Thu, 23 Jan 2025 09:01:34 +1100 Subject: [PATCH 22/31] test --- .github/workflows/export_config_push_uat.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml index d115f0c6..8df35a56 100644 --- a/.github/workflows/export_config_push_uat.yml +++ b/.github/workflows/export_config_push_uat.yml @@ -52,10 +52,8 @@ jobs: - name: Run export script run: | - echo "==> Using deploy user email: ${{ secrets.DEPLOY_USER_EMAIL }}" - echo "==> Using deploy user name: ${{ secrets.DEPLOY_USER_NAME }}" cd /app - scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" "${{ secrets.DEPLOY_USER_EMAIL }}" "${{ secrets.DEPLOY_USER_NAME }}" + scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" env: DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} From 289302452a50c7df6dcdef24f3b6bf84f0f108ef Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Thu, 23 Jan 2025 15:38:24 +1100 Subject: [PATCH 23/31] push uat --- .github/workflows/export_config_push_uat.yml | 64 -------------------- .github/workflows/force_push_to_uat.yml | 58 ++++++++---------- 2 files changed, 26 insertions(+), 96 deletions(-) delete mode 100644 .github/workflows/export_config_push_uat.yml diff --git a/.github/workflows/export_config_push_uat.yml b/.github/workflows/export_config_push_uat.yml deleted file mode 100644 index 8df35a56..00000000 --- a/.github/workflows/export_config_push_uat.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: export_config - -on: - workflow_call: - inputs: - branch_name: - description: "Branch name to export config and push changes (e.g., release/SCFA-1234)" - required: true - type: string - uat_push: - description: "Push to UAT flag" - required: false - default: false - type: boolean - -env: - REGISTRY: ghcr.io - -jobs: - export_config: - name: Export Config and Push to UAT - runs-on: biggy - container: - image: ghcr.io/dpc-sdp/bay/ci-builder:5.x - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - - - name: Log into registry ghcr.io - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Uncomment database snapshot environment variable - run: | - sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env - - - name: Configure Git - run: | - git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - - - name: Copy repo - run: | - chown -R $(id -u):$(id -g) $PWD - cp -R ${GITHUB_WORKSPACE} /app - - - name: Run export script - run: | - cd /app - scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" - env: - DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} - DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} - - - name: Notify completion - if: success() - run: | - echo "Export config completed and pushed to branch ${{ inputs.branch_name }}." diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index ab53840d..30c58fd6 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -1,45 +1,39 @@ name: force_push_to_uat -on: +on: workflow_call: + inputs: + branch_name: + description: "Branch name to push changes to (e.g., release/SCFA-1234)" + required: true + type: string jobs: force_push_to_uat: - name: force_push_to_uat - if: startsWith(github.event.branches[0].name, 'release/') + name: Force Push to UAT runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Output caller branch - run: echo ${{ github.event.branches[0].name }} - - name: Output tested commit - run: echo ${{ github.event.branches[0].commit.sha }} - - name: Determine status state - run: | - output=$(curl -L \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.branches[0].commit.sha }}/status) - - api_status=$(echo "$output" | jq -r '.statuses[] | select(.context == "api") | .state') - e2e_status=$(echo "$output" | jq -r '.statuses[] | select(.context == "e2e_be") | .state') - build_status=$(echo "$output" | jq -r '.statuses[] | select(.context == "tide_build") | .state') + with: + fetch-depth: 0 - echo "API test status is $api_status" - echo "E2E test status is $e2e_status" - echo "Build status is $build_status" + - name: Configure Git + run: | + git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" + git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" - if [[ $api_status == "success" && $e2e_status == "failure" && $build_status == "failure" ]]; then - echo "==> All checks passed, deploying to UAT." - exit 0 - else - echo "==> Checks pending or failed, holding." - exit 1 - fi - - name: Force push + - name: Force Push to UAT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - cd ${GITHUB_WORKSPACE} - chmod +x .circleci/force-push-to-uat.sh - .circleci/force-push-to-uat.sh \ No newline at end of file + # Ensure we are in the correct branch + git checkout "${{ inputs.branch_name }}" + + # Force push to UAT branch + git push origin "${{ inputs.branch_name }}:uat" --force + + - name: Notify Completion + if: success() + run: echo "Branch ${{ inputs.branch_name }} has been force pushed to UAT." From 9a11d08c3ef686ec6378439765e32cbaf56e5fad Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Thu, 23 Jan 2025 15:38:46 +1100 Subject: [PATCH 24/31] push uat --- .github/workflows/rel_export_config.yml | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/rel_export_config.yml diff --git a/.github/workflows/rel_export_config.yml b/.github/workflows/rel_export_config.yml new file mode 100644 index 00000000..8df35a56 --- /dev/null +++ b/.github/workflows/rel_export_config.yml @@ -0,0 +1,64 @@ +name: export_config + +on: + workflow_call: + inputs: + branch_name: + description: "Branch name to export config and push changes (e.g., release/SCFA-1234)" + required: true + type: string + uat_push: + description: "Push to UAT flag" + required: false + default: false + type: boolean + +env: + REGISTRY: ghcr.io + +jobs: + export_config: + name: Export Config and Push to UAT + runs-on: biggy + container: + image: ghcr.io/dpc-sdp/bay/ci-builder:5.x + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Log into registry ghcr.io + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Uncomment database snapshot environment variable + run: | + sed -i 's|# DB_IMAGE_SNAPSHOT|DB_IMAGE_SNAPSHOT|' .env + + - name: Configure Git + run: | + git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" && git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" + + - name: Copy repo + run: | + chown -R $(id -u):$(id -g) $PWD + cp -R ${GITHUB_WORKSPACE} /app + + - name: Run export script + run: | + cd /app + scripts/export-config-push-uat.sh "${{ inputs.branch_name }}" + env: + DEPLOY_USER_EMAIL: ${{ secrets.DEPLOY_USER_EMAIL }} + DEPLOY_USER_NAME: ${{ secrets.DEPLOY_USER_NAME }} + + - name: Notify completion + if: success() + run: | + echo "Export config completed and pushed to branch ${{ inputs.branch_name }}." From 1d30c4e8c90ae8f61e7317be30b3bf7a034e3d4b Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Thu, 23 Jan 2025 17:21:16 +1100 Subject: [PATCH 25/31] test --- .github/workflows/force_push_to_uat.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index 30c58fd6..91ac298f 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -29,6 +29,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Ensure we are in the correct branch + + git log "${{ inputs.branch_name }}" git checkout "${{ inputs.branch_name }}" # Force push to UAT branch From ca49f453f5361297d47e241561988bf5f15daa13 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Fri, 24 Jan 2025 09:49:01 +1100 Subject: [PATCH 26/31] test --- .github/workflows/force_push_to_uat.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index 91ac298f..c6d94553 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -17,23 +17,23 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 # Fetch full branch history - - name: Configure Git + - name: Fetch and Pull Latest Changes run: | - git config --global user.email "${{ secrets.DEPLOY_USER_EMAIL }}" - git config --global user.name "${{ secrets.DEPLOY_USER_NAME }}" + git fetch origin "${{ inputs.branch_name }}" + git checkout "${{ inputs.branch_name }}" + git pull origin "${{ inputs.branch_name }}" # Ensure latest commits are present + + - name: Log Branch State + run: | + echo "Branch state before force-push:" + git log --oneline -5 - name: Force Push to UAT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Ensure we are in the correct branch - - git log "${{ inputs.branch_name }}" - git checkout "${{ inputs.branch_name }}" - - # Force push to UAT branch git push origin "${{ inputs.branch_name }}:uat" --force - name: Notify Completion From b85eb9234b29e08441a0b6d9c46059add35889cb Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Fri, 24 Jan 2025 09:57:11 +1100 Subject: [PATCH 27/31] test --- .github/workflows/rel_export_config.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/rel_export_config.yml b/.github/workflows/rel_export_config.yml index 8df35a56..40435e6d 100644 --- a/.github/workflows/rel_export_config.yml +++ b/.github/workflows/rel_export_config.yml @@ -7,11 +7,6 @@ on: description: "Branch name to export config and push changes (e.g., release/SCFA-1234)" required: true type: string - uat_push: - description: "Push to UAT flag" - required: false - default: false - type: boolean env: REGISTRY: ghcr.io From 103db3b62be99c535050110a491456362c23a358 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Fri, 24 Jan 2025 17:13:36 +1100 Subject: [PATCH 28/31] test --- .github/workflows/force_push_to_uat.yml | 2 +- .github/workflows/rel_export_config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index c6d94553..34e29cf9 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -10,7 +10,7 @@ on: jobs: force_push_to_uat: - name: Force Push to UAT + name: Force Push Branch to UAT runs-on: ubuntu-latest steps: diff --git a/.github/workflows/rel_export_config.yml b/.github/workflows/rel_export_config.yml index 40435e6d..f225837a 100644 --- a/.github/workflows/rel_export_config.yml +++ b/.github/workflows/rel_export_config.yml @@ -13,7 +13,7 @@ env: jobs: export_config: - name: Export Config and Push to UAT + name: Export Config and Push to Branch runs-on: biggy container: image: ghcr.io/dpc-sdp/bay/ci-builder:5.x From 4a85690559ef06ce74da403254edb50cee48cd94 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 28 Jan 2025 10:39:27 +1100 Subject: [PATCH 29/31] test --- .github/workflows/force_push_to_uat.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index 34e29cf9..fe6d2739 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -30,11 +30,11 @@ jobs: echo "Branch state before force-push:" git log --oneline -5 - - name: Force Push to UAT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git push origin "${{ inputs.branch_name }}:uat" --force + # - name: Force Push to UAT + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # git push origin "${{ inputs.branch_name }}:uat" --force - name: Notify Completion if: success() From a6ef86177579f6adba02f11e057111c3e7c9e230 Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 28 Jan 2025 11:55:10 +1100 Subject: [PATCH 30/31] test --- .github/workflows/force_push_to_uat.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/force_push_to_uat.yml b/.github/workflows/force_push_to_uat.yml index fe6d2739..34e29cf9 100644 --- a/.github/workflows/force_push_to_uat.yml +++ b/.github/workflows/force_push_to_uat.yml @@ -30,11 +30,11 @@ jobs: echo "Branch state before force-push:" git log --oneline -5 - # - name: Force Push to UAT - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # run: | - # git push origin "${{ inputs.branch_name }}:uat" --force + - name: Force Push to UAT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git push origin "${{ inputs.branch_name }}:uat" --force - name: Notify Completion if: success() From c04393f0a59bfb193507b2e152e0eb207939810a Mon Sep 17 00:00:00 2001 From: Keith Lau Date: Tue, 28 Jan 2025 19:25:14 +1100 Subject: [PATCH 31/31] create PR GHA --- .github/workflows/create_pull_request.yml | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/create_pull_request.yml diff --git a/.github/workflows/create_pull_request.yml b/.github/workflows/create_pull_request.yml new file mode 100644 index 00000000..248e4ed1 --- /dev/null +++ b/.github/workflows/create_pull_request.yml @@ -0,0 +1,32 @@ +name: Create Pull Request + +on: + workflow_call: + inputs: + branch_name: + description: "Branch name to create PR from" + required: true + type: string + PR_message: + description: "PR Message" + required: false + default: Automated PR generated using GHA + type: string + +jobs: + create_pull_request: + name: Create Pull Request + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Create Pull Request + run: | + gh pr create \ + --title "Automated tide pull request for release {{ release }}" \ + --body "${{ inputs.PR_message }}" \ + --base develop \ + --head ${{ inputs.branch_name }} \ + --repo ${{ github.repository }}