From 64a1504e8fe5aa791852e4c2d7813a993b4350cf Mon Sep 17 00:00:00 2001 From: Andrew Boni Signori <61259237+andrewsignori-aot@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:11:13 -0800 Subject: [PATCH] #4130 - Update Openshift Github Actions (#4131) - Added the [openshift-tools-installer](https://github.com/redhat-actions/openshift-tools-installer) to all action steps that require some OC iteration. - Using the [default options](https://github.com/redhat-actions/openshift-tools-installer?tab=readme-ov-file#inputs). - Using the fixed version "4". The current version printed is `OC CLI Version: Client Version: 4.17.9`. Please note, for steps printing the `OC version`, the new action was added before the print step. For steps not printing the `OC version`, the new step was added right before the "Log in to OpenShift". Sample workflow execution with the new step working: https://github.com/bcgov/SIMS/actions/runs/12378896945/job/34551860119 --- .github/workflows/clamav.yml | 4 ++ .github/workflows/crunchy-db.yml | 4 ++ .../env-setup-build-forms-server.yml | 5 +++ .github/workflows/env-setup-delete-redis.yml | 4 ++ .../env-setup-deploy-forms-server.yml | 5 +++ .github/workflows/env-setup-deploy-redis.yml | 4 ++ .../workflows/env-setup-deploy-secrets.yml | 4 ++ .../env-setup-init-redis-cluster-redis.yml | 4 ++ .../workflows/env-setup-redis-recovery.yml | 4 ++ .github/workflows/prune-images.yml | 14 +++++-- .github/workflows/release-build-all.yml | 26 +++++++++++- .github/workflows/release-deploy-all.yml | 40 ++++++++++++------- 12 files changed, 98 insertions(+), 20 deletions(-) diff --git a/.github/workflows/clamav.yml b/.github/workflows/clamav.yml index 079bb5d70b..a19d8164aa 100644 --- a/.github/workflows/clamav.yml +++ b/.github/workflows/clamav.yml @@ -33,6 +33,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/crunchy-db.yml b/.github/workflows/crunchy-db.yml index 9bef25f727..9062198ece 100644 --- a/.github/workflows/crunchy-db.yml +++ b/.github/workflows/crunchy-db.yml @@ -38,6 +38,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/env-setup-build-forms-server.yml b/.github/workflows/env-setup-build-forms-server.yml index 1c4ca3000f..6d644f4277 100644 --- a/.github/workflows/env-setup-build-forms-server.yml +++ b/.github/workflows/env-setup-build-forms-server.yml @@ -18,10 +18,15 @@ jobs: BUILD_NAMESPACE: ${{ vars.BUILD_NAMESPACE }} FORMIO_SOURCE_REPO_TAG: ${{ inputs.formioTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: $BUILD_REF + echo OC CLI Version: $(oc version) # Checkout the PR branch - name: Checkout Target Branch uses: actions/checkout@v4 diff --git a/.github/workflows/env-setup-delete-redis.yml b/.github/workflows/env-setup-delete-redis.yml index 3b48c556f3..54c5e1aac2 100644 --- a/.github/workflows/env-setup-delete-redis.yml +++ b/.github/workflows/env-setup-delete-redis.yml @@ -23,6 +23,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/env-setup-deploy-forms-server.yml b/.github/workflows/env-setup-deploy-forms-server.yml index 0266a4ee6c..4cf7a04751 100644 --- a/.github/workflows/env-setup-deploy-forms-server.yml +++ b/.github/workflows/env-setup-deploy-forms-server.yml @@ -32,10 +32,15 @@ jobs: TLS_KEY: ${{ secrets.TLS_KEY }} TLS_CA_CERTIFICATE: ${{ secrets.TLS_CA_CERTIFICATE }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo NAMESPACE: $NAMESPACE echo HOST_PREFIX: $HOST_PREFIX + echo OC CLI Version: $(oc version) # Checkout the PR branch - name: Checkout Target Branch uses: actions/checkout@v4 diff --git a/.github/workflows/env-setup-deploy-redis.yml b/.github/workflows/env-setup-deploy-redis.yml index 2b187f4684..909918b7c1 100644 --- a/.github/workflows/env-setup-deploy-redis.yml +++ b/.github/workflows/env-setup-deploy-redis.yml @@ -23,6 +23,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/env-setup-deploy-secrets.yml b/.github/workflows/env-setup-deploy-secrets.yml index afdff881ba..9b299624d2 100644 --- a/.github/workflows/env-setup-deploy-secrets.yml +++ b/.github/workflows/env-setup-deploy-secrets.yml @@ -60,6 +60,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/env-setup-init-redis-cluster-redis.yml b/.github/workflows/env-setup-init-redis-cluster-redis.yml index b7d2c1fa31..9c29928449 100644 --- a/.github/workflows/env-setup-init-redis-cluster-redis.yml +++ b/.github/workflows/env-setup-init-redis-cluster-redis.yml @@ -23,6 +23,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/env-setup-redis-recovery.yml b/.github/workflows/env-setup-redis-recovery.yml index 7a285b94d2..0ca66e3ff0 100644 --- a/.github/workflows/env-setup-redis-recovery.yml +++ b/.github/workflows/env-setup-redis-recovery.yml @@ -27,6 +27,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} diff --git a/.github/workflows/prune-images.yml b/.github/workflows/prune-images.yml index 0b1abde9f7..286ebfa560 100644 --- a/.github/workflows/prune-images.yml +++ b/.github/workflows/prune-images.yml @@ -18,9 +18,9 @@ on: required: true default: "web-sims, api-sims, queue-consumers-sims, workers-sims" ocjobs: - description: "Comma seperated list of job Image Streams to prune" - required: true - default: "db.migrations" + description: "Comma seperated list of job Image Streams to prune" + required: true + default: "db.migrations" prefix: description: "Branch prefix to restrict pruning to" required: false @@ -44,6 +44,11 @@ jobs: echo "PREFIX=${{ inputs.prefix || 'main' }}" >> $GITHUB_ENV echo "MIN_TAGS=${{ inputs.minTags || '10' }}" >> $GITHUB_ENV + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" + - name: Print env run: | echo "Environment: ${ENVIRONMENT}" @@ -51,6 +56,7 @@ jobs: echo "Jobs: ${OCJOBS}" echo "Prefix: ${PREFIX}" echo "Minimum Tags: ${MIN_TAGS}" + echo "OC CLI Version: $(oc version)" - name: Checkout source code uses: actions/checkout@v4 @@ -80,4 +86,4 @@ jobs: --prefix=${PREFIX} \ --min_tags=${MIN_TAGS} \ --type=JOB - popd \ No newline at end of file + popd diff --git a/.github/workflows/release-build-all.yml b/.github/workflows/release-build-all.yml index fad7b5e3d1..02544957b4 100644 --- a/.github/workflows/release-build-all.yml +++ b/.github/workflows/release-build-all.yml @@ -26,7 +26,6 @@ jobs: echo Git Ref Name: ${{ github.ref_name }} echo Git Head: ${{ github.event.pull_request.head.sha }} echo Run Number: ${{ github.run_number }} - echo OC CLI Version: $(oc version) # Create new tag. createTag: @@ -64,10 +63,15 @@ jobs: env: BUILD_REF: ${{ needs.createTag.outputs.newTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: ${{ needs.createTag.outputs.newTag }} + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: @@ -88,10 +92,15 @@ jobs: env: BUILD_REF: ${{ needs.createTag.outputs.newTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: ${{ needs.createTag.outputs.newTag }} + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: @@ -112,10 +121,15 @@ jobs: env: BUILD_REF: ${{ needs.createTag.outputs.newTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: ${{ needs.createTag.outputs.newTag }} + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: @@ -136,10 +150,15 @@ jobs: env: BUILD_REF: ${{ needs.createTag.outputs.newTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: ${{ needs.createTag.outputs.newTag }} + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: @@ -160,10 +179,15 @@ jobs: env: BUILD_REF: ${{ needs.createTag.outputs.newTag }} steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD NAMESPACE: $BUILD_NAMESPACE echo BRANCH: ${{ needs.createTag.outputs.newTag }} + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: diff --git a/.github/workflows/release-deploy-all.yml b/.github/workflows/release-deploy-all.yml index 975d1fc242..e147db9228 100644 --- a/.github/workflows/release-deploy-all.yml +++ b/.github/workflows/release-deploy-all.yml @@ -106,21 +106,23 @@ jobs: environment: ${{ inputs.environment }} runs-on: ubuntu-latest steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo Deploy Environment: ${{ inputs.environment }} echo GIT REF: ${{ inputs.gitRef }} echo BUILD NAMESPACE: $BUILD_NAMESPACE - + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} - - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} - - name: Run db-migrations working-directory: "./devops/" run: | @@ -133,21 +135,23 @@ jobs: runs-on: ubuntu-latest needs: run-db-migrations steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo Deploy ENVIRONMENT: ${{ inputs.environment }} echo GIT REF: ${{ inputs.gitRef }} echo BUILD NAMESPACE: $BUILD_NAMESPACE - + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} - - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} - - name: Deploy SIMS-API working-directory: "./devops/" run: | @@ -162,20 +166,22 @@ jobs: runs-on: ubuntu-latest needs: run-db-migrations steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo BUILD ENVIRONMENT: ${{ inputs.environment }} echo GIT REF: ${{ inputs.gitRef }} - + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} - - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} - - name: Deploy Workers working-directory: "./devops/" run: | @@ -188,21 +194,23 @@ jobs: runs-on: ubuntu-latest needs: run-db-migrations steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo Deploy ENVIRONMENT: ${{ inputs.environment }} echo GIT REF: ${{ inputs.gitRef }} echo BUILD NAMESPACE: $BUILD_NAMESPACE - + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} - - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} - - name: Deploy Queue Consumers working-directory: "./devops/" run: | @@ -215,21 +223,23 @@ jobs: runs-on: ubuntu-latest needs: run-db-migrations steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4" - name: Print env run: | echo Deploy ENVIRONMENT: ${{ inputs.environment }} echo GIT REF: ${{ inputs.gitRef }} echo BUILD NAMESPACE: $BUILD_NAMESPACE - + echo OC CLI Version: $(oc version) - name: Checkout Target Branch uses: actions/checkout@v4 with: ref: ${{ inputs.gitRef }} - - name: Log in to OpenShift run: | oc login --token=${{ secrets.SA_TOKEN }} --server=${{ vars.OPENSHIFT_CLUSTER_URL }} - - name: Deploy Web/Frontend working-directory: "./devops/" run: |