From 91d7b3550a4284ac00274026c4db6da2f80de21e Mon Sep 17 00:00:00 2001 From: Kuan Fan <31664961+kuanfandevops@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:16:03 -0800 Subject: [PATCH 1/8] Update package.json --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index 6a14401a..8414a50f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "1.29.0", + "version": "1.30.0", "private": true, "dependencies": { "@date-io/date-fns": "^2.14.0", From 8a6f73058f4462cf1d32c34e2035e78ae71151be Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Wed, 4 Dec 2024 11:47:02 -0800 Subject: [PATCH 2/8] remove gitopsteam.yaml --- gitopsteam.yaml | 65 ------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 gitopsteam.yaml diff --git a/gitopsteam.yaml b/gitopsteam.yaml deleted file mode 100644 index 56701b4b..00000000 --- a/gitopsteam.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# GitOpsTeam - create this CRD in your tools namespace in order to enable -# Argo CD for your project -apiVersion: warden.devops.gov.bc.ca/v1alpha1 -kind: GitOpsTeam -metadata: - name: gitopsteam-itvr - namespace: ac294c-tools -spec: - # gitOpsMembers defines the git repo access (tenant-gitops-XYZ) - # Note that users with repo access will have to accept an invitation from - # GitHub to join the bcgov-c GitHub organization if they are not already - # members. - # - # Warning: GitHub IDs are CASE SENSITIVE - # - # ----------------------------------------------------------------------- - gitOpsMembers: - # Full admin access to the repo, including repo deletion, adding of users - # Recommended for people who need full access to the project, including - # sensitive and destructive actions like managing security or deleting a - # repository. - admins: - - kuanfandevops - - tim738745 - - # Recommended for contributors who actively push to your project. - writers: - - emi-hi - - JulianForeman - - # Recommended for project managers who need to manage the repository without - # access to sensitive or destructive actions. - maintainers: - - shayjeff - - # Recommended for non-code contributors who want to view or discuss your - # project. - readers: - - airinggov - - ArawuSamuel1 - - katerinkus - - Lalita-Lala - - # Recommended for contributors who need to manage issues and pull requests - # without write access. - triage: - - # projectMembers defines access to the Argo CD UI - # ----------------------------------------------- - projectMembers: - # Project Maintainers have full access to the Argo CD Project, including the - # ability create, edit, and delete Applications within the Project - maintainers: - - kuanfandevops@github - - tim738745@github - - emi-hi@github - - JulianForeman@github - - # Project Readers have read-only access to the Project in the Argo CD UI - readers: - - shayjeff@github - - airinggov@github - - ArawuSamuel1 - - katerinkus - - Lalita-Lala From 79a4f21ae3288d94f1a8a4deb0c3bc707c261078 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Thu, 12 Dec 2024 16:36:05 -0800 Subject: [PATCH 3/8] apply artifact pull secret --- openshift/templates/backend/backend-bc.yaml | 4 ---- openshift/templates/cra/cra-bc-docker.yaml | 19 +++++-------------- .../frontend/frontend-bc-docker.yaml | 18 ++++-------------- .../task-queue/task-queue-bc-docker.yaml | 6 ++---- 4 files changed, 11 insertions(+), 36 deletions(-) diff --git a/openshift/templates/backend/backend-bc.yaml b/openshift/templates/backend/backend-bc.yaml index ee0c62e9..67fe8cc2 100644 --- a/openshift/templates/backend/backend-bc.yaml +++ b/openshift/templates/backend/backend-bc.yaml @@ -88,9 +88,5 @@ objects: forcePull: true noCache: true type: Source - triggers: - - imageChange: {} - type: ImageChange - - type: ConfigChange status: lastVersion: 0 \ No newline at end of file diff --git a/openshift/templates/cra/cra-bc-docker.yaml b/openshift/templates/cra/cra-bc-docker.yaml index 27c8ea89..aa86a9ec 100644 --- a/openshift/templates/cra/cra-bc-docker.yaml +++ b/openshift/templates/cra/cra-bc-docker.yaml @@ -67,18 +67,9 @@ objects: strategy: dockerStrategy: dockerfilePath: ./Dockerfile-Openshift - env: - - name: ARTIFACTORY_USER - valueFrom: - secretKeyRef: - name: artifacts-default-pwpgbz - key: username - - name: ARTIFACTORY_PASSWORD - valueFrom: - secretKeyRef: - name: artifacts-default-pwpgbz - key: password + pullSecret: + name: artifacts-pull-default-pwpgbz + forcePull: true + noCache: true type: Docker - triggers: - - type: ConfigChange - - type: ImageChange + diff --git a/openshift/templates/frontend/frontend-bc-docker.yaml b/openshift/templates/frontend/frontend-bc-docker.yaml index a41507de..d1454edf 100644 --- a/openshift/templates/frontend/frontend-bc-docker.yaml +++ b/openshift/templates/frontend/frontend-bc-docker.yaml @@ -67,18 +67,8 @@ objects: strategy: dockerStrategy: dockerfilePath: ./Dockerfile-Openshift - env: - - name: ARTIFACTORY_USER - valueFrom: - secretKeyRef: - name: artifacts-default-pwpgbz - key: username - - name: ARTIFACTORY_PASSWORD - valueFrom: - secretKeyRef: - name: artifacts-default-pwpgbz - key: password + pullSecret: + name: artifacts-pull-default-pwpgbz + forcePull: true + noCache: true type: Docker - triggers: - - type: ConfigChange - - type: ImageChange \ No newline at end of file diff --git a/openshift/templates/task-queue/task-queue-bc-docker.yaml b/openshift/templates/task-queue/task-queue-bc-docker.yaml index 5711e055..2adc8f9b 100644 --- a/openshift/templates/task-queue/task-queue-bc-docker.yaml +++ b/openshift/templates/task-queue/task-queue-bc-docker.yaml @@ -72,10 +72,8 @@ objects: dockerfilePath: ./Dockerfile-Openshift-Taskq pullSecret: name: artifacts-default-pwpgbz + forcePull: true + noCache: true type: Docker - # triggers: - # - imageChange: {} - # type: ImageChange - # - type: ConfigChange status: lastVersion: 0 \ No newline at end of file From c2db31d3d6e2e9825ac9b2bf4de8dc953442fd54 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Mon, 16 Dec 2024 16:40:38 -0800 Subject: [PATCH 4/8] install and cache oc command --- .github/workflows/dev-ci.yaml | 56 +++++++++++++++++++++++++-- .github/workflows/pr-build.yaml | 62 +++++++++++++++++++++++++++--- .github/workflows/pr-teardown.yaml | 32 +++++++++++++++ .github/workflows/prod-ci.yaml | 38 +++++++++++++++++- .github/workflows/test-ci.yaml | 39 +++++++++++++++++++ 5 files changed, 218 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev-ci.yaml b/.github/workflows/dev-ci.yaml index d57465c9..763c9b51 100644 --- a/.github/workflows/dev-ci.yaml +++ b/.github/workflows/dev-ci.yaml @@ -18,10 +18,36 @@ concurrency: cancel-in-progress: true jobs: + install-oc: + runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache.outputs.cache-hit }} + steps: + - name: Check out repository + uses: actions/checkout@v4.1.1 + + - name: Set up cache for OpenShift CLI + id: cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc # Path where the `oc` binary will be installed + key: oc-cli-${{ runner.os }} + + - name: Install OpenShift CLI (if not cached) + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz + tar -xvf openshift-client-linux.tar.gz + sudo mv oc /usr/local/bin/ + oc version --client + + - name: Confirm OpenShift CLI is Available + run: oc version --client verify-pr: name: Verify pull request title started with Tracking runs-on: ubuntu-latest + needs: [install-oc] steps: - name: Check PR Title id: check_pr_title @@ -95,6 +121,12 @@ jobs: - name: Check out repository uses: actions/checkout@v4.1.1 + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -132,6 +164,12 @@ jobs: - name: Check out repository uses: actions/checkout@v4.1.1 + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -167,7 +205,11 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4.1.1 - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -205,7 +247,11 @@ jobs: uses: actions/checkout@v4.1.1 with: ref: ${{ github.event.pull_request.head.ref }} - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -262,7 +308,11 @@ jobs: git add itvr/values-dev.yaml git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Dev" git push - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index af9745eb..8eec0482 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -19,17 +19,49 @@ concurrency: cancel-in-progress: true jobs: + install-oc: + runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache.outputs.cache-hit }} + steps: + - name: Check out repository + uses: actions/checkout@v4.1.1 + + - name: Set up cache for OpenShift CLI + id: cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc # Path where the `oc` binary will be installed + key: oc-cli-${{ runner.os }} + + - name: Install OpenShift CLI (if not cached) + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz + tar -xvf openshift-client-linux.tar.gz + sudo mv oc /usr/local/bin/ + oc version --client + + - name: Confirm OpenShift CLI is Available + run: oc version --client + get-version: if: > (github.event.action == 'labeled' && github.event.label.name == 'build' && github.event.pull_request.base.ref == github.event.repository.default_branch) || (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == github.event.repository.default_branch) name: Retrieve version runs-on: ubuntu-latest + needs: [install-oc] outputs: VERSION: ${{ steps.get-version.outputs.VERSION }} steps: + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -67,7 +99,11 @@ jobs: uses: actions/checkout@v4.1.1 with: ref: ${{ github.event.pull_request.head.ref }} - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -107,7 +143,11 @@ jobs: uses: actions/checkout@v4.1.1 with: ref: ${{ github.event.pull_request.head.ref }} - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -147,7 +187,11 @@ jobs: uses: actions/checkout@v4.1.1 with: ref: ${{ github.event.pull_request.head.ref }} - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -187,7 +231,11 @@ jobs: uses: actions/checkout@v4.1.1 with: ref: ${{ github.event.pull_request.head.ref }} - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -245,7 +293,11 @@ jobs: replace: "${{ env.PR_NUMBER }}" include: "itvr/values-dev-pr.yaml" regex: false - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: diff --git a/.github/workflows/pr-teardown.yaml b/.github/workflows/pr-teardown.yaml index b7224151..d397c65c 100644 --- a/.github/workflows/pr-teardown.yaml +++ b/.github/workflows/pr-teardown.yaml @@ -13,6 +13,32 @@ concurrency: cancel-in-progress: true jobs: + install-oc: + runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache.outputs.cache-hit }} + steps: + - name: Check out repository + uses: actions/checkout@v4.1.1 + + - name: Set up cache for OpenShift CLI + id: cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc # Path where the `oc` binary will be installed + key: oc-cli-${{ runner.os }} + + - name: Install OpenShift CLI (if not cached) + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz + tar -xvf openshift-client-linux.tar.gz + sudo mv oc /usr/local/bin/ + oc version --client + + - name: Confirm OpenShift CLI is Available + run: oc version --client + teardown: if: > (github.event.action == 'unlabeled' && github.event.label.name == 'build') || @@ -20,8 +46,14 @@ jobs: name: PR Teardown runs-on: ubuntu-latest timeout-minutes: 60 + needs: [install-oc] steps: + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: diff --git a/.github/workflows/prod-ci.yaml b/.github/workflows/prod-ci.yaml index 034b74e5..ce833745 100644 --- a/.github/workflows/prod-ci.yaml +++ b/.github/workflows/prod-ci.yaml @@ -13,14 +13,46 @@ concurrency: cancel-in-progress: true jobs: + install-oc: + runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache.outputs.cache-hit }} + steps: + - name: Check out repository + uses: actions/checkout@v4.1.1 + + - name: Set up cache for OpenShift CLI + id: cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc # Path where the `oc` binary will be installed + key: oc-cli-${{ runner.os }} + + - name: Install OpenShift CLI (if not cached) + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz + tar -xvf openshift-client-linux.tar.gz + sudo mv oc /usr/local/bin/ + oc version --client + + - name: Confirm OpenShift CLI is Available + run: oc version --client + get-build-suffix: name: Find Dev deployment build suffix runs-on: ubuntu-latest + needs: [install-oc] outputs: BUILD_SUFFIX: ${{ steps.get-build-suffix.outputs.BUILD_SUFFIX }} steps: + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -90,7 +122,11 @@ jobs: git add itvr/values-prod.yaml git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Prod" git push - + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: diff --git a/.github/workflows/test-ci.yaml b/.github/workflows/test-ci.yaml index 617e9324..1703473d 100644 --- a/.github/workflows/test-ci.yaml +++ b/.github/workflows/test-ci.yaml @@ -13,14 +13,47 @@ concurrency: cancel-in-progress: true jobs: + install-oc: + runs-on: ubuntu-latest + outputs: + cache-hit: ${{ steps.cache.outputs.cache-hit }} + steps: + - name: Check out repository + uses: actions/checkout@v4.1.1 + + - name: Set up cache for OpenShift CLI + id: cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc # Path where the `oc` binary will be installed + key: oc-cli-${{ runner.os }} + + - name: Install OpenShift CLI (if not cached) + if: steps.cache.outputs.cache-hit != 'true' + run: | + curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz + tar -xvf openshift-client-linux.tar.gz + sudo mv oc /usr/local/bin/ + oc version --client + + - name: Confirm OpenShift CLI is Available + run: oc version --client + get-build-suffix: name: Find Dev deployment build suffix runs-on: ubuntu-latest + needs: [install-oc] outputs: BUILD_SUFFIX: ${{ steps.get-build-suffix.outputs.BUILD_SUFFIX }} steps: + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -91,6 +124,12 @@ jobs: git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Test" git push + - name: Restore oc command from Cache + uses: actions/cache@v4.2.0 + with: + path: /usr/local/bin/oc + key: oc-cli-${{ runner.os }} + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: From cc72ecebf8eff7d9a6d2b7afd017e3ae0b4af5ee Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Wed, 18 Dec 2024 13:47:00 -0800 Subject: [PATCH 5/8] reorg test-ci --- .github/workflows/test-ci.yaml | 36 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-ci.yaml b/.github/workflows/test-ci.yaml index 1703473d..8c28f81e 100644 --- a/.github/workflows/test-ci.yaml +++ b/.github/workflows/test-ci.yaml @@ -18,14 +18,11 @@ jobs: outputs: cache-hit: ${{ steps.cache.outputs.cache-hit }} steps: - - name: Check out repository - uses: actions/checkout@v4.1.1 - - name: Set up cache for OpenShift CLI id: cache uses: actions/cache@v4.2.0 with: - path: /usr/local/bin/oc # Path where the `oc` binary will be installed + path: /usr/local/bin/oc # Path where the `oc` binary will be installed key: oc-cli-${{ runner.os }} - name: Install OpenShift CLI (if not cached) @@ -81,13 +78,17 @@ jobs: timeout-minutes: 60 steps: + - id: get-current-time + run: | + echo "CURRENT_TIME=$(TZ='America/Vancouver' date '+%Y-%m-%d %H:%M:%S %Z')" >> $GITHUB_OUTPUT + - name: Ask for approval for ITVR Test deployment uses: trstringer/manual-approval@v1.6.0 with: secret: ${{ github.TOKEN }} approvers: emi-hi,tim738745,kuanfandevops,JulianForeman,rogerlcleung minimum-approvals: 1 - issue-title: "ITVR ${{ needs.get-build-suffix.outputs.BUILD_SUFFIX }} Test Deployment" + issue-title: "ITVR ${{ needs.get-build-suffix.outputs.BUILD_SUFFIX }} Test Deployment at ${{ steps.get-current-time.outputs.CURRENT_TIME }}" deploy: name: Deploy ITVR on Test @@ -129,7 +130,7 @@ jobs: with: path: /usr/local/bin/oc key: oc-cli-${{ runner.os }} - + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -141,16 +142,13 @@ jobs: - name: Tag and deploy to Test run: | helm -n ${{ env.DEV_NAMESPACE }} list - oc tag ${{ env.DEV_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.DEV_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.DEV_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.DEV_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} - - - name: Helm Deployment - run: | - cd itvr - helm -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml upgrade --install itvr-test . \ - --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" + # oc tag ${{ env.DEV_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.DEV_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.DEV_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.DEV_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} + # cd itvr + # helm -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml upgrade --install itvr-test . \ + # --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" From 9b49d97e6d8a99a3af6f9fb13262abbae5b63ef8 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Wed, 18 Dec 2024 13:50:05 -0800 Subject: [PATCH 6/8] open test-ci deployment --- .github/workflows/test-ci.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-ci.yaml b/.github/workflows/test-ci.yaml index 8c28f81e..36fed5cf 100644 --- a/.github/workflows/test-ci.yaml +++ b/.github/workflows/test-ci.yaml @@ -142,13 +142,13 @@ jobs: - name: Tag and deploy to Test run: | helm -n ${{ env.DEV_NAMESPACE }} list - # oc tag ${{ env.DEV_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.DEV_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.DEV_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.DEV_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} - # cd itvr - # helm -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml upgrade --install itvr-test . \ - # --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" + oc tag ${{ env.DEV_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.DEV_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.DEV_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.DEV_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} + cd itvr + helm -n ${{ env.TEST_NAMESPACE }} -f ./values-test.yaml upgrade --install itvr-test . \ + --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" From af7ee451dab2f01aa3ad66ba1658613ea5eafe79 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Wed, 18 Dec 2024 13:52:13 -0800 Subject: [PATCH 7/8] reorg prod-ci --- .github/workflows/prod-ci.yaml | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/prod-ci.yaml b/.github/workflows/prod-ci.yaml index ce833745..e0745b13 100644 --- a/.github/workflows/prod-ci.yaml +++ b/.github/workflows/prod-ci.yaml @@ -18,14 +18,11 @@ jobs: outputs: cache-hit: ${{ steps.cache.outputs.cache-hit }} steps: - - name: Check out repository - uses: actions/checkout@v4.1.1 - - name: Set up cache for OpenShift CLI id: cache uses: actions/cache@v4.2.0 with: - path: /usr/local/bin/oc # Path where the `oc` binary will be installed + path: /usr/local/bin/oc # Path where the `oc` binary will be installed key: oc-cli-${{ runner.os }} - name: Install OpenShift CLI (if not cached) @@ -80,13 +77,17 @@ jobs: timeout-minutes: 60 steps: + - id: get-current-time + run: | + echo "CURRENT_TIME=$(TZ='America/Vancouver' date '+%Y-%m-%d %H:%M:%S %Z')" >> $GITHUB_OUTPUT + - name: Ask for approval for ITVR Prod deployment uses: trstringer/manual-approval@v1.6.0 with: secret: ${{ github.TOKEN }} approvers: emi-hi,tim738745,kuanfandevops,JulianForeman,rogerlcleung - minimum-approvals: 2 - issue-title: "ITVR ${{ needs.get-build-suffix.outputs.BUILD_SUFFIX }} Prod Deployment" + minimum-approvals: 1 + issue-title: "ITVR ${{ needs.get-build-suffix.outputs.BUILD_SUFFIX }} Prod Deployment at ${{ steps.get-current-time.outputs.CURRENT_TIME }}" deploy: name: Deploy ITVR on Prod @@ -122,11 +123,13 @@ jobs: git add itvr/values-prod.yaml git commit -m "Update the image tag to ${{ env.BUILD_SUFFIX }} on Prod" git push + - name: Restore oc command from Cache uses: actions/cache@v4.2.0 with: path: /usr/local/bin/oc key: oc-cli-${{ runner.os }} + - name: Log in to Openshift uses: redhat-actions/oc-login@v1.3 with: @@ -138,16 +141,13 @@ jobs: - name: Tag and deploy to Prod run: | helm -n ${{ env.PROD_NAMESPACE }} list - oc tag ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} - oc tag ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} - - - name: Helm Deployment - run: | - cd itvr - helm -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml upgrade --install itvr-prod . \ - --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" + # oc tag ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} + # oc tag ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} + # cd itvr + # helm -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml upgrade --install itvr-prod . \ + # --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + # --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" From e5432a3bad226f3421bd946e7d4c6193c9d02154 Mon Sep 17 00:00:00 2001 From: Kuan Fan Date: Wed, 18 Dec 2024 13:59:00 -0800 Subject: [PATCH 8/8] open prod-ci deployment --- .github/workflows/prod-ci.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/prod-ci.yaml b/.github/workflows/prod-ci.yaml index e0745b13..31d49d0c 100644 --- a/.github/workflows/prod-ci.yaml +++ b/.github/workflows/prod-ci.yaml @@ -71,7 +71,7 @@ jobs: fi approval-deploy-on-prod: - name: Approval the deployment on Pest + name: Approval the deployment on Prod needs: get-build-suffix runs-on: ubuntu-latest timeout-minutes: 60 @@ -141,13 +141,13 @@ jobs: - name: Tag and deploy to Prod run: | helm -n ${{ env.PROD_NAMESPACE }} list - # oc tag ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} - # oc tag ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} - # cd itvr - # helm -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml upgrade --install itvr-prod . \ - # --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ - # --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E" + oc tag ${{ env.TEST_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-backend:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.TEST_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-frontend:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.TEST_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-cra:${{ env.BUILD_SUFFIX }} + oc tag ${{ env.TEST_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} ${{ env.PROD_NAMESPACE }}/itvr-task-queue:${{ env.BUILD_SUFFIX }} + cd itvr + helm -n ${{ env.PROD_NAMESPACE }} -f ./values-prod.yaml upgrade --install itvr-prod . \ + --set frontend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set backend.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set cra.podAnnotations.rolloutTriggered="A$(date +%s)E" \ + --set task-queue.podAnnotations.rolloutTriggered="A$(date +%s)E"