From 0f0796ef99b0122a84954d7fbda20f8e315d8488 Mon Sep 17 00:00:00 2001 From: weskubo-cgi Date: Fri, 1 Nov 2024 12:05:31 -0700 Subject: [PATCH] Added explicit tag selection and input summary to workflows higher than Dev. Added input summary to tag workflow. --- .github/workflows/create-git-and-image-tag.yml | 5 +++++ .../deploy-to-openshift-backend-efx.yml | 18 ++++++++++++------ .../deploy-to-openshift-backend-prod.yml | 18 ++++++++++++------ .../deploy-to-openshift-backend-test.yml | 18 ++++++++++++------ .../deploy-to-openshift-backend-uat.yml | 18 ++++++++++++------ .../deploy-to-openshift-frontend-efx.yml | 18 ++++++++++++------ .../deploy-to-openshift-frontend-prod.yml | 18 ++++++++++++------ .../deploy-to-openshift-frontend-test.yml | 16 +++++++++++----- .../deploy-to-openshift-frontend-uat.yml | 18 ++++++++++++------ 9 files changed, 100 insertions(+), 47 deletions(-) diff --git a/.github/workflows/create-git-and-image-tag.yml b/.github/workflows/create-git-and-image-tag.yml index 55b052ff..526fcc77 100644 --- a/.github/workflows/create-git-and-image-tag.yml +++ b/.github/workflows/create-git-and-image-tag.yml @@ -26,6 +26,11 @@ jobs: environment: dev steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check out repository uses: actions/checkout@v3 diff --git a/.github/workflows/deploy-to-openshift-backend-efx.yml b/.github/workflows/deploy-to-openshift-backend-efx.yml index d9fe7e6a..be9f782e 100644 --- a/.github/workflows/deploy-to-openshift-backend-efx.yml +++ b/.github/workflows/deploy-to-openshift-backend-efx.yml @@ -40,6 +40,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -52,6 +57,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -95,10 +105,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -118,7 +124,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "backend image stream in place" # Create tag for UAT env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} # Process and apply deployment template oc process -f tools/openshift/backend.dc.yaml \ @@ -126,7 +132,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-backend-prod.yml b/.github/workflows/deploy-to-openshift-backend-prod.yml index 06495cef..6a207020 100644 --- a/.github/workflows/deploy-to-openshift-backend-prod.yml +++ b/.github/workflows/deploy-to-openshift-backend-prod.yml @@ -38,6 +38,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -50,6 +55,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -93,10 +103,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -116,7 +122,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "backend image stream in place" # Create tag for PROD env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-prod/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-prod/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} # Process and apply deployment template oc process -f tools/openshift/backend-tls.dc.yaml \ @@ -124,7 +130,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-backend-test.yml b/.github/workflows/deploy-to-openshift-backend-test.yml index e0365e37..d9730c99 100644 --- a/.github/workflows/deploy-to-openshift-backend-test.yml +++ b/.github/workflows/deploy-to-openshift-backend-test.yml @@ -39,6 +39,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -51,6 +56,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -94,10 +104,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -114,7 +120,7 @@ jobs: || true && echo "No rollout in progress" # Create tag for TEST env from DEV env image - # oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:${{ steps.get-latest-tag.outputs.tag }} + # oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}-${{ env.BRANCH }}:${{ inputs.tag }} # Process and apply deployment template oc process \ @@ -123,7 +129,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag}} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-backend-uat.yml b/.github/workflows/deploy-to-openshift-backend-uat.yml index d249ed9a..d62e0521 100644 --- a/.github/workflows/deploy-to-openshift-backend-uat.yml +++ b/.github/workflows/deploy-to-openshift-backend-uat.yml @@ -40,6 +40,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -52,6 +57,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -95,10 +105,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -118,7 +124,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "backend image stream in place" # Create tag for UAT env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_BACKEND }}:${{ inputs.tag }} # Process and apply deployment template oc process -f tools/openshift/backend.dc.yaml \ @@ -126,7 +132,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag}} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-frontend-efx.yml b/.github/workflows/deploy-to-openshift-frontend-efx.yml index 3f4b0ea5..5d1625b8 100644 --- a/.github/workflows/deploy-to-openshift-frontend-efx.yml +++ b/.github/workflows/deploy-to-openshift-frontend-efx.yml @@ -48,6 +48,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -60,6 +65,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -103,10 +113,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -126,7 +132,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "frontend image stream in place" # Create tag for EFX env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} # Process and apply deployment template oc process \ @@ -135,7 +141,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-frontend-prod.yml b/.github/workflows/deploy-to-openshift-frontend-prod.yml index c3d142f7..29dca7e2 100644 --- a/.github/workflows/deploy-to-openshift-frontend-prod.yml +++ b/.github/workflows/deploy-to-openshift-frontend-prod.yml @@ -43,6 +43,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -55,6 +60,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -98,10 +108,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -121,7 +127,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "frontend image stream in place" # Create tag for PROD env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-prod/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-prod/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} # Process and apply deployment template oc process \ @@ -130,7 +136,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-frontend-test.yml b/.github/workflows/deploy-to-openshift-frontend-test.yml index bfdf7eda..2f27cc0a 100644 --- a/.github/workflows/deploy-to-openshift-frontend-test.yml +++ b/.github/workflows/deploy-to-openshift-frontend-test.yml @@ -47,6 +47,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -59,6 +64,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -102,10 +112,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -128,7 +134,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \ diff --git a/.github/workflows/deploy-to-openshift-frontend-uat.yml b/.github/workflows/deploy-to-openshift-frontend-uat.yml index bf117a40..0d67471c 100644 --- a/.github/workflows/deploy-to-openshift-frontend-uat.yml +++ b/.github/workflows/deploy-to-openshift-frontend-uat.yml @@ -48,6 +48,11 @@ env: on: workflow_dispatch: + inputs: + tag: + description: 'The image tag to deploy' + required: true + type: string jobs: openshift-ci-cd: @@ -60,6 +65,11 @@ jobs: SELECTOR: ${{ steps.deploy-and-expose.outputs.selector }} steps: + - name: Print Workflow Dispatch Inputs and Env Vars + uses: shayki5/print-workflow-dispatch-inputs@v1 + with: + add_to_summary: 'true' + print_env_vars: 'false' - name: Check for required secrets uses: actions/github-script@v6 with: @@ -103,10 +113,6 @@ jobs: with: ref: ${{ env.BRANCH }} - - name: Get latest tag - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - name: Install oc uses: redhat-actions/openshift-tools-installer@v1 with: @@ -126,7 +132,7 @@ jobs: oc create imagestream ${{ env.IMAGE_NAME }} 2> /dev/null || true && echo "frontend image stream in place" # Create tag for UAT env from DEV env image - oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ steps.get-latest-tag.outputs.tag }} + oc tag ${{ env.NAMESPACE }}-dev/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} ${{ env.NAMESPACE }}-test/${{ env.REPO_NAME }}-${{ env.APP_NAME_FRONTEND }}:${{ inputs.tag }} # Process and apply deployment template oc process \ @@ -135,7 +141,7 @@ jobs: -p REPO_NAME=${{ env.REPO_NAME }} \ -p BRANCH=${{ env.BRANCH }} \ -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} \ - -p TAG=${{ steps.get-latest-tag.outputs.tag }} \ + -p TAG=${{ inputs.tag }} \ -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} \ -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} \ -p MIN_CPU=${{ env.MIN_CPU }} \