From 7822d6259f007d99bb39ff16280970bf74398c35 Mon Sep 17 00:00:00 2001 From: Matt S Date: Tue, 8 Aug 2023 10:27:49 -0600 Subject: [PATCH 01/15] Update to support better error logging and running all jobs in parellel despite failure --- .github/workflows/lint-cfn.yml | 75 ++++++++++++++++++++-------------- README.md | 66 ++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index cbe723c..914e366 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -16,33 +16,48 @@ on: required: true jobs: - lint-cloudformation: - runs-on: ubuntu-latest - - steps: - - name: Echo Version - run: | - echo 'lint-cfn v1.0.0' - - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Cloud Formation Formatter - run: | - gh release download --repo aws-cloudformation/rain --pattern "*_linux-amd64.zip" --output "rain.zip" - unzip -j "rain.zip" "*/rain" - env: - GH_TOKEN: ${{ secrets.env-github-token }} - - - name: Verify with Cloud Formation Formatter - run: | - ./rain fmt --verify ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} - - - name: Setup Cloud Formation Linter - uses: scottbrenner/cfn-lint-action@v2 - - - name: Verify with Cloud Formation Linter - run: | - cfn-lint --version - echo 'Running CFN Linter on ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }}' - cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} + verify-cloudformation-formatting: + runs-on: ubuntu-latest + + steps: + - name: Echo Version + run: | + echo 'lint-cfn v1.0.1' + + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Cloud Formation Formatter + run: | + gh release download --repo aws-cloudformation/rain --pattern "*_linux-amd64.zip" --output "rain.zip" + unzip -j "rain.zip" "*/rain" + env: + GH_TOKEN: ${{ secrets.env-github-token }} + + - name: Verify with Cloud Formation Formatter + run: | + ./rain fmt --verify ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} + + verify-cloudformation-linting: + runs-on: ubuntu-latest + + steps: + - name: Echo Version + run: | + echo 'lint-cfn v1.0.1' + + - name: Setup Cloud Formation Linter + uses: scottbrenner/cfn-lint-action@v2 + + - name: Verify with Cloud Formation Linter + run: | + cfn-lint --version + echo 'Running CFN Linter on ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }}' + cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} + + - name: Advice for Addressing Action Failure - CloudFormation Linting + if: failure() + run: | + echo 'Your build failed due to your CloudFormation template file(s) requiring edits to pass our required linting rules.' + echo 'Please review the previous "Verify with Cloud Formation Linter" step for more explicit failure reasoning.' + echo 'Consult the ReadMe for guidance ' diff --git a/README.md b/README.md index 0424cda..8912a43 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,68 @@ # github-actions Used to store GitHub actions for use across the enterprise + +## References for Included Actions + +### CFN Formatting (rain) + +#### How to Format Locally +If you have made a change to the CloudFormation templates you need to be sure to format them and commit those changes to pass the GitHub actions validations. +1. Format command: `rain fmt ./py/template.yml ./ts/template.yml -w` +- *NOTE:* the -w ensures you write the changes back to the same file +- *NOTE:* the path to your file names may be different, in this example we are assuming you have two template files located at `./py/template.yml` and `./ts/template.yml` in your repo. +2. Save the file and commit + push these changes to the repo + +#### Installation (rain) +- Installation instructions for local usage: https://github.com/aws-cloudformation/rain +- *NOTE:* At time of writing the recommendation is to install via brew: `brew install rain` + +#### Example - Failed Validation, Need to Reformat (rain fmt) +In this example, I need to run rain fmt, save, and push the changes due to ./ts/template.yml formatting mistakes. +``` +Run ./rain fmt --verify ./py/template.yml ./ts/template.yml +./py/template.yml: formatted OK +./ts/template.yml: would reformat +Error: Process completed with exit code 1. +``` + +#### Example - Successful Validation (rain fmt) +``` +Run ./rain fmt --verify ./py/template.yml ./ts/template.yml +./py/template.yml: formatted OK +./ts/template.yml: formatted OK +``` + +### CFN Linting (cfn-lint) +The cfn-lint tool checks the CFN template files adhere to the following rules: https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/rules.md#rules-1 + +#### Installation (cfn-lint) +- Installation instructions for local usage: https://github.com/aws-cloudformation/cfn-lint +- *NOTE:* At time of writing the recommendation is to install via brew: `brew install cfn-lint` + +#### Example - Warning (cfn-lint) + +When the GitHub action runs to lint the CFN, you may see a warning, prefixed with a W which will fail the build. +``` +Run cfn-lint --version +cfn-lint 0.79.3 +Running CFN Linter on ./py/template.yml ./ts/template.yml +W2001 Parameter SnsFilePubArn not used. +Warning: ./ts/template.yml:20:3 + +Error: Process completed with exit code 4. +``` + +For example to resolve the error output above I need to: +(1) remove the unused CFN parameter value for SnsFilePubArn, +(2) save the file, +(3) commit the change and +(4) push those changes. + + +#### Example - Successful Validation (cfn-lint) + +``` +Run cfn-lint --version +cfn-lint 0.79.3 +Running CFN Linter on ./py/template.yml ./ts/template.yml +``` From daddb9c4476f9459e0958e0f4edfc72a5d2ccff8 Mon Sep 17 00:00:00 2001 From: Matt S Date: Tue, 8 Aug 2023 13:13:24 -0600 Subject: [PATCH 02/15] Update for directions when a case has failed --- .github/workflows/lint-cfn.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index 914e366..3197e7c 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -22,34 +22,42 @@ jobs: steps: - name: Echo Version run: | - echo 'lint-cfn v1.0.1' + echo 'lint-cfn v1.1.0' - name: Checkout uses: actions/checkout@v3 - - name: Setup Cloud Formation Formatter + - name: Setup CloudFormation Formatter run: | gh release download --repo aws-cloudformation/rain --pattern "*_linux-amd64.zip" --output "rain.zip" unzip -j "rain.zip" "*/rain" env: GH_TOKEN: ${{ secrets.env-github-token }} - - name: Verify with Cloud Formation Formatter + - name: Verify with CloudFormation Formatter run: | ./rain fmt --verify ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} + - name: Advice for Addressing Action Failure - CloudFormation Formatting + if: failure() + run: | + echo 'Your build failed due to your CloudFormation template file(s) requiring edits to pass our required formatting rules.' + echo 'Please review the previous "Verify with CloudFormation Formatter" step to see which file(s) need to be formatted.' + echo 'You need to format the CloudFormation file(s) using the autoformatter before commiting your change.' + echo 'Consult the ReadMe for guidance https://github.com/VirdocsSoftware/github-actions/tree/main#cfn-formatting-rain' + verify-cloudformation-linting: runs-on: ubuntu-latest steps: - name: Echo Version run: | - echo 'lint-cfn v1.0.1' + echo 'lint-cfn v1.1.0' - - name: Setup Cloud Formation Linter + - name: Setup CloudFormation Linter uses: scottbrenner/cfn-lint-action@v2 - - name: Verify with Cloud Formation Linter + - name: Verify with CloudFormation Linter run: | cfn-lint --version echo 'Running CFN Linter on ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }}' @@ -59,5 +67,6 @@ jobs: if: failure() run: | echo 'Your build failed due to your CloudFormation template file(s) requiring edits to pass our required linting rules.' - echo 'Please review the previous "Verify with Cloud Formation Linter" step for more explicit failure reasoning.' - echo 'Consult the ReadMe for guidance ' + echo 'Please review the previous "Verify with CloudFormation Linter" step for more explicit failure reasoning.' + echo 'You need to correct the linting warnings and errors before commiting your change.' + echo 'Consult the ReadMe for guidance https://github.com/VirdocsSoftware/github-actions/tree/main#cfn-linting-cfn-lint' From 4255da0d17ac268010787437d629fd38a4b38768 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 10 Aug 2023 22:59:17 -0600 Subject: [PATCH 03/15] Fix: add repo checkout to cfn-lint --- .github/workflows/lint-cfn.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index 3197e7c..9849aa4 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -54,6 +54,9 @@ jobs: run: | echo 'lint-cfn v1.1.0' + - name: Checkout + uses: actions/checkout@v3 + - name: Setup CloudFormation Linter uses: scottbrenner/cfn-lint-action@v2 From 316e6f531b1ece79500812c1edcd4fe70b7be139 Mon Sep 17 00:00:00 2001 From: Matt S Date: Wed, 16 Aug 2023 14:57:20 -0600 Subject: [PATCH 04/15] Update to allow ignoring cfn-clint checks --- .github/workflows/lint-cfn.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index 9849aa4..839da81 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -10,6 +10,11 @@ on: required: false type: string default: "" + cfn-lint-checks-ignored: + description: "(Optional) The array of rules to ignore. cfn-lint will only check rules whose ID do not match or prefix these values." + required: false + type: string + default: "[]" secrets: env-github-token: description: "A valid GitHub token to be used by the action." @@ -22,7 +27,7 @@ jobs: steps: - name: Echo Version run: | - echo 'lint-cfn v1.1.0' + echo 'lint-cfn v1.2.0' - name: Checkout uses: actions/checkout@v3 @@ -52,7 +57,7 @@ jobs: steps: - name: Echo Version run: | - echo 'lint-cfn v1.1.0' + echo 'lint-cfn v1.2.0' - name: Checkout uses: actions/checkout@v3 @@ -64,7 +69,7 @@ jobs: run: | cfn-lint --version echo 'Running CFN Linter on ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }}' - cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} + cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} -i ${{ inputs.cfn-lint-checks-ignored }} - name: Advice for Addressing Action Failure - CloudFormation Linting if: failure() From bfb066657890ad63fdc9a6e630bf645bef5d86a8 Mon Sep 17 00:00:00 2001 From: Matt S Date: Wed, 16 Aug 2023 15:20:40 -0600 Subject: [PATCH 05/15] fix: update ignore checks argument pass thru --- .github/workflows/lint-cfn.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index 839da81..27aae07 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -11,10 +11,10 @@ on: type: string default: "" cfn-lint-checks-ignored: - description: "(Optional) The array of rules to ignore. cfn-lint will only check rules whose ID do not match or prefix these values." + description: "(Optional) The space delimited set of rules to ignore. cfn-lint will only check rules whose ID do not match or prefix these values." required: false type: string - default: "[]" + default: "" secrets: env-github-token: description: "A valid GitHub token to be used by the action." From e3d1bae6544a343a8955548d3032b12794715608 Mon Sep 17 00:00:00 2001 From: Matt S Date: Wed, 16 Aug 2023 15:37:58 -0600 Subject: [PATCH 06/15] fix: rm hardcoded -i --- .github/workflows/lint-cfn.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-cfn.yml b/.github/workflows/lint-cfn.yml index 27aae07..a806e23 100644 --- a/.github/workflows/lint-cfn.yml +++ b/.github/workflows/lint-cfn.yml @@ -10,8 +10,8 @@ on: required: false type: string default: "" - cfn-lint-checks-ignored: - description: "(Optional) The space delimited set of rules to ignore. cfn-lint will only check rules whose ID do not match or prefix these values." + cfn-lint-additional-command: + description: "(Optional) Used to pass a space delimited set of rules to ignore. cfn-lint will only check rules whose ID do not match or prefix these values. For ex: `-i W3002`" required: false type: string default: "" @@ -69,7 +69,7 @@ jobs: run: | cfn-lint --version echo 'Running CFN Linter on ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }}' - cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} -i ${{ inputs.cfn-lint-checks-ignored }} + cfn-lint -t ${{ inputs.cfn-template-file-1 }} ${{ inputs.cfn-template-file-2 }} ${{ inputs.cfn-lint-additional-command }} - name: Advice for Addressing Action Failure - CloudFormation Linting if: failure() From 83d0fda7b17f02d9c56ee87a159706a50d020632 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 09:00:54 -0600 Subject: [PATCH 07/15] Add devops-vars workflow action --- .github/workflows/devops-vars.yml | 158 ++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .github/workflows/devops-vars.yml diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml new file mode 100644 index 0000000..3e806ac --- /dev/null +++ b/.github/workflows/devops-vars.yml @@ -0,0 +1,158 @@ +on: + workflow_call: + # inputs: + # github-ref-name: + # description: "The ref name for the current action. Example: ref/heads/develop." + # required: true + # type: string + +jobs: + devops-env-vars: + runs-on: ubuntu-latest + outputs: + DEVOPS_ENV_NAME_DEV: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }} + DEVOPS_ENV_NAME_UAT: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }} + DEVOPS_ENV_NAME_DEMO: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }} + DEVOPS_ENV_NAME_PROD: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }} + DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: ${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_IS_FEATURE_BRANCH: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }} + steps: + - name: Echo Version + run: | + echo 'devops-vars v1.3.0' + + - name: Define DEVOPS_CURRENT_DEPLOYMENT_ENV_NAMEs + id: define-deployment-envs + shell: bash + run: | + #!/bin/bash + echo "Setting the four available Deployment Environments to be:" + + env_dev=dev + echo "DEVOPS_ENV_NAME_DEV=$env_dev" + echo "DEVOPS_ENV_NAME_DEV=$env_dev" >> $GITHUB_OUTPUT; + + env_uat=uat + echo "DEVOPS_ENV_NAME_UAT=$env_uat" + echo "DEVOPS_ENV_NAME_UAT=$env_uat" >> $GITHUB_OUTPUT; + + env_demo=demo + echo "DEVOPS_ENV_NAME_DEMO=$env_demo" + echo "DEVOPS_ENV_NAME_DEMO=$env_demo" >> $GITHUB_OUTPUT; + + env_prod=prod + echo "DEVOPS_ENV_NAME_PROD=$env_prod" + echo "DEVOPS_ENV_NAME_PROD=$env_prod" >> $GITHUB_OUTPUT; + + - name: Determine value of variable DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME + id: determine-deployment-env + env: + GITHUB_BRANCH_NAME: ${{ github.ref_name }} + shell: bash + run: | + #!/bin/bash + refname=$GITHUB_BRANCH_NAME + echo "Branch Ref is ${GITHUB_BRANCH_NAME}" + + # These are the special branch names that indicate the environment we are deploying to. + reDev="develop" + reUat="uat" + reDemo="demo" + reProd="main" + + # Setting Feature Branch Flag to be false + echo "Setting DEVOPS_IS_FEATURE_BRANCH to 'false' by default"; + echo "DEVOPS_IS_FEATURE_BRANCH=false" >> $GITHUB_OUTPUT; + + # Logic for Checking Deployment Env + echo "Checking if branch name indicates a deployment to one of the four environments (dev, uat, demo, or prod)" + if [[ $refname =~ $reProd ]]; then + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }}" >> $GITHUB_OUTPUT; + elif [[ $refname =~ $reUat ]]; then + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }}" >> $GITHUB_OUTPUT; + elif [[ $refname =~ $reDemo ]]; then + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }}" >> $GITHUB_OUTPUT; + elif [[ $refname =~ $reDev ]]; then + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; + else + # In case none of the above occurs + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_IS_FEATURE_BRANCH to 'true' becuase this is not one of the four known environment branches."; + echo "DEVOPS_IS_FEATURE_BRANCH=true" >> $GITHUB_OUTPUT; + fi; + + - name: Echo DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME + run: echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" + + - name: Echo DEVOPS_IS_FEATURE_BRANCH + run: echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" + + + devops-jira-vars: + runs-on: ubuntu-latest + needs: [devops-env-vars] + outputs: + DEVOPS_JIRA_TICKET_ID: ${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} + steps: + - name: Echo Version + run: | + echo 'devops-vars v1.3.0' + + - name: Extract JIRA Prefix to Variable DEVOPS_JIRA_TICKET_ID + id: extract-jira-ticket-id + env: + GITHUB_BRANCH_NAME: ${{ github.ref_name }} + shell: bash + run: | + #!/bin/bash + # Set to "N/A" if not a feature branch + if [ ${{ needs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then + echo "DEVOPS_JIRA_TICKET_ID=N/A" >> $GITHUB_OUTPUT; + else + refname=$GITHUB_BRANCH_NAME + re="[A-Z]+-[0-9]+" + + echo "Checking if branch name contains a JIRA issue (format MID-1234, AN-1 or similar)" + if [[ $refname =~ $re ]]; then + echo "JIRA Ticket ID found within ${refname}"; + echo "DEVOPS_JIRA_TICKET_ID=$(echo ${BASH_REMATCH[0]})" >> $GITHUB_OUTPUT; + else + echo "Malformed Branch Name: ${refname} does not contain a JIRA Ticket ID and is not a known env specific branch."; + exit 1; + fi + fi; + + - name: Echo DEVOPS_JIRA_TICKET_ID + run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" + + + devops-branch-vars: + runs-on: ubuntu-latest + needs: [devops-env-vars, devops-jira-vars] + outputs: + DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} + steps: + - name: Echo Version + run: | + echo 'devops-vars v1.3.0' + + - name: Determine Branch Env Name based upon DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME and DEVOPS_IS_FEATURE_BRANCH + id: determine-branch-env-name + shell: bash + run: | + #!/bin/bash + if [ ${{ needs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then + echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; + echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.devops-jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; + else + echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; + echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.devops-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; + fi; + + - name: Echo DEVOPS_BRANCH_ENV_NAME + run: echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }}" From f7808d114c3bce320f23aac7f75af03d4de0b76b Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 12:03:40 -0600 Subject: [PATCH 08/15] Update devops-vars outputs --- .github/workflows/devops-vars.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 3e806ac..25c73a1 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -1,10 +1,28 @@ on: workflow_call: - # inputs: - # github-ref-name: - # description: "The ref name for the current action. Example: ref/heads/develop." - # required: true - # type: string + outputs: + DEVOPS_ENV_NAME_DEV: + description: "The name of the 'dev' deployment environment" + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_DEV }} + DEVOPS_ENV_NAME_UAT: + description: "The name of the 'uat' deployment environment" + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_UAT }} + DEVOPS_ENV_NAME_DEMO: + description: "The name of the 'demo' deployment environment" + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_DEMO }} + DEVOPS_ENV_NAME_PROD: + description: "The name of the 'prod' deployment environment" + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_PROD }} + DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: + description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_IS_FEATURE_BRANCH: + description: "A true/false flag that indicates whether the current GitHub branch is a feature branch or not. It is determined to be a feature branch if the branch name is not one of: 'develop', 'uat', 'demo', 'main'." + value: ${{ jobs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} + DEVOPS_BRANCH_ENV_NAME: + description: "A value to append to CloudFormation stack names and AWS resource names for the purpose of " + value: ${{ jobs.devops-branch-vars.outputs.DEVOPS_BRANCH_ENV_NAME }} + jobs: devops-env-vars: From beeb113be198860dc2509a5969b7b8808929c9ad Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 12:40:47 -0600 Subject: [PATCH 09/15] Update devops-vars workflow to emit all outputs --- .github/workflows/devops-vars.yml | 43 +++++++++++++++++-------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 25c73a1..eff6856 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -1,31 +1,34 @@ on: workflow_call: outputs: + DEVOPS_BRANCH_ENV_NAME: + description: "A value to append to CloudFormation stack names and AWS resource names for the purpose of unique names." + value: ${{ jobs.branch-vars.outputs.DEVOPS_BRANCH_ENV_NAME }} + DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: + description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." + value: ${{ jobs.env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} DEVOPS_ENV_NAME_DEV: description: "The name of the 'dev' deployment environment" - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_DEV }} + value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_DEV }} DEVOPS_ENV_NAME_UAT: description: "The name of the 'uat' deployment environment" - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_UAT }} + value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_UAT }} DEVOPS_ENV_NAME_DEMO: description: "The name of the 'demo' deployment environment" - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_DEMO }} + value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_DEMO }} DEVOPS_ENV_NAME_PROD: description: "The name of the 'prod' deployment environment" - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_ENV_NAME_PROD }} - DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: - description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_PROD }} DEVOPS_IS_FEATURE_BRANCH: description: "A true/false flag that indicates whether the current GitHub branch is a feature branch or not. It is determined to be a feature branch if the branch name is not one of: 'develop', 'uat', 'demo', 'main'." - value: ${{ jobs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} - DEVOPS_BRANCH_ENV_NAME: - description: "A value to append to CloudFormation stack names and AWS resource names for the purpose of " - value: ${{ jobs.devops-branch-vars.outputs.DEVOPS_BRANCH_ENV_NAME }} + value: ${{ jobs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} + DEVOPS_JIRA_TICKET_ID: + description: "The JIRA Ticket ID that was found within the branch name. Only expect a value when DEVOPS_IS_FEATURE_BRANCH is true. Defaults to 'N/A' in the case one doesn't exist in the branch name or isn't a feature branch." + value: ${{ jobs.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }} jobs: - devops-env-vars: + env-vars: runs-on: ubuntu-latest outputs: DEVOPS_ENV_NAME_DEV: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }} @@ -111,9 +114,9 @@ jobs: run: echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" - devops-jira-vars: + jira-vars: runs-on: ubuntu-latest - needs: [devops-env-vars] + needs: [env-vars] outputs: DEVOPS_JIRA_TICKET_ID: ${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} steps: @@ -129,7 +132,7 @@ jobs: run: | #!/bin/bash # Set to "N/A" if not a feature branch - if [ ${{ needs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then + if [ ${{ needs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then echo "DEVOPS_JIRA_TICKET_ID=N/A" >> $GITHUB_OUTPUT; else refname=$GITHUB_BRANCH_NAME @@ -149,9 +152,9 @@ jobs: run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" - devops-branch-vars: + branch-vars: runs-on: ubuntu-latest - needs: [devops-env-vars, devops-jira-vars] + needs: [env-vars, jira-vars] outputs: DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} steps: @@ -164,12 +167,12 @@ jobs: shell: bash run: | #!/bin/bash - if [ ${{ needs.devops-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then + if [ ${{ needs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.devops-jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; else echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.devops-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; fi; - name: Echo DEVOPS_BRANCH_ENV_NAME From bbdcaafa048973be678a29482b70802e08c0785b Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 14:23:12 -0600 Subject: [PATCH 10/15] Consolidate action jobs --- .github/workflows/devops-vars.yml | 161 +++++++++++++----------------- 1 file changed, 69 insertions(+), 92 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index eff6856..20599c9 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -3,72 +3,55 @@ on: outputs: DEVOPS_BRANCH_ENV_NAME: description: "A value to append to CloudFormation stack names and AWS resource names for the purpose of unique names." - value: ${{ jobs.branch-vars.outputs.DEVOPS_BRANCH_ENV_NAME }} + value: ${{ jobs.define-outputs.outputs.DEVOPS_BRANCH_ENV_NAME }} DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." - value: ${{ jobs.env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} - DEVOPS_ENV_NAME_DEV: - description: "The name of the 'dev' deployment environment" - value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_DEV }} - DEVOPS_ENV_NAME_UAT: - description: "The name of the 'uat' deployment environment" - value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_UAT }} - DEVOPS_ENV_NAME_DEMO: - description: "The name of the 'demo' deployment environment" - value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_DEMO }} - DEVOPS_ENV_NAME_PROD: - description: "The name of the 'prod' deployment environment" - value: ${{ jobs.env-vars.outputs.DEVOPS_ENV_NAME_PROD }} + value: ${{ jobs.define-outputs.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_IS_ENV_DEV: + description: "A true/false flag that indicates whether the current GitHub branch will target the 'DEV' deployment environment." + value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_DEV }} + DEVOPS_IS_ENV_UAT: + description: "A true/false flag that indicates whether the current GitHub branch will target the 'UAT' deployment environment." + value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_UAT }} + DEVOPS_IS_ENV_DEMO: + description: "A true/false flag that indicates whether the current GitHub branch will target the 'DEMO' deployment environment." + value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_DEMO }} + DEVOPS_IS_ENV_PROD: + description: "A true/false flag that indicates whether the current GitHub branch will target the 'PROD' deployment environment." + value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_PROD }} DEVOPS_IS_FEATURE_BRANCH: description: "A true/false flag that indicates whether the current GitHub branch is a feature branch or not. It is determined to be a feature branch if the branch name is not one of: 'develop', 'uat', 'demo', 'main'." - value: ${{ jobs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} + value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} DEVOPS_JIRA_TICKET_ID: description: "The JIRA Ticket ID that was found within the branch name. Only expect a value when DEVOPS_IS_FEATURE_BRANCH is true. Defaults to 'N/A' in the case one doesn't exist in the branch name or isn't a feature branch." - value: ${{ jobs.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }} + value: ${{ jobs.define-outputs.outputs.DEVOPS_JIRA_TICKET_ID }} jobs: - env-vars: + define-outputs: runs-on: ubuntu-latest outputs: - DEVOPS_ENV_NAME_DEV: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }} - DEVOPS_ENV_NAME_UAT: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }} - DEVOPS_ENV_NAME_DEMO: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }} - DEVOPS_ENV_NAME_PROD: ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }} + DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: ${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_IS_ENV_DEV: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEV }} + DEVOPS_IS_ENV_UAT: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_UAT }} + DEVOPS_IS_ENV_DEMO: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }} + DEVOPS_IS_ENV_PROD: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_PROD }} DEVOPS_IS_FEATURE_BRANCH: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }} + DEVOPS_JIRA_TICKET_ID: ${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} steps: - name: Echo Version run: | echo 'devops-vars v1.3.0' - - name: Define DEVOPS_CURRENT_DEPLOYMENT_ENV_NAMEs - id: define-deployment-envs - shell: bash - run: | - #!/bin/bash - echo "Setting the four available Deployment Environments to be:" - - env_dev=dev - echo "DEVOPS_ENV_NAME_DEV=$env_dev" - echo "DEVOPS_ENV_NAME_DEV=$env_dev" >> $GITHUB_OUTPUT; - - env_uat=uat - echo "DEVOPS_ENV_NAME_UAT=$env_uat" - echo "DEVOPS_ENV_NAME_UAT=$env_uat" >> $GITHUB_OUTPUT; - - env_demo=demo - echo "DEVOPS_ENV_NAME_DEMO=$env_demo" - echo "DEVOPS_ENV_NAME_DEMO=$env_demo" >> $GITHUB_OUTPUT; - - env_prod=prod - echo "DEVOPS_ENV_NAME_PROD=$env_prod" - echo "DEVOPS_ENV_NAME_PROD=$env_prod" >> $GITHUB_OUTPUT; - - name: Determine value of variable DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME id: determine-deployment-env env: GITHUB_BRANCH_NAME: ${{ github.ref_name }} + BRANCH_NAME_DEV: ${{ vars.DEVOPS_BRANCH_NAME_DEV }} + BRANCH_NAME_UAT: ${{ vars.DEVOPS_BRANCH_NAME_UAT }} + BRANCH_NAME_DEMO: ${{ vars.DEVOPS_BRANCH_NAME_DEMO }} + BRANCH_NAME_PROD: ${{ vars.DEVOPS_BRANCH_NAME_PROD }} shell: bash run: | #!/bin/bash @@ -76,53 +59,58 @@ jobs: echo "Branch Ref is ${GITHUB_BRANCH_NAME}" # These are the special branch names that indicate the environment we are deploying to. - reDev="develop" - reUat="uat" - reDemo="demo" - reProd="main" - - # Setting Feature Branch Flag to be false - echo "Setting DEVOPS_IS_FEATURE_BRANCH to 'false' by default"; + reDev=${BRANCH_NAME_DEV} + echo "Branch Name Dev = ${BRANCH_NAME_DEV}" + reUat=${BRANCH_NAME_UAT} + echo "Branch Name UAT = ${BRANCH_NAME_UAT}" + reDemo=${BRANCH_NAME_DEMO} + echo "Branch Name Demo = ${BRANCH_NAME_DEMO}" + reProd=${BRANCH_NAME_PROD} + echo "Branch Name Prod = ${BRANCH_NAME_PROD}" + + echo "Setting Feature and Env Branch Flags to be false by default" echo "DEVOPS_IS_FEATURE_BRANCH=false" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_DEV=false" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_UAT=false" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_DEMO=false" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_PROD=false" >> $GITHUB_OUTPUT; # Logic for Checking Deployment Env echo "Checking if branch name indicates a deployment to one of the four environments (dev, uat, demo, or prod)" if [[ $refname =~ $reProd ]]; then - echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }}"; - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_PROD }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to ${{ vars.DEVOPS_ENV_NAME_PROD }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ vars.DEVOPS_ENV_NAME_PROD }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_PROD=true" >> $GITHUB_OUTPUT; elif [[ $refname =~ $reUat ]]; then - echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }}"; - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_UAT }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ vars.DEVOPS_ENV_NAME_UAT }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ vars.DEVOPS_ENV_NAME_UAT }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_UAT=true" >> $GITHUB_OUTPUT; elif [[ $refname =~ $reDemo ]]; then - echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }}"; - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEMO }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ vars.DEVOPS_ENV_NAME_DEMO }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ vars.DEVOPS_ENV_NAME_DEMO }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_DEMO=true" >> $GITHUB_OUTPUT; elif [[ $refname =~ $reDev ]]; then - echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}"; - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ vars.DEVOPS_ENV_NAME_DEV }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ vars.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_DEV=true" >> $GITHUB_OUTPUT; else # In case none of the above occurs - echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}"; - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.define-deployment-envs.outputs.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; - echo "Setting DEVOPS_IS_FEATURE_BRANCH to 'true' becuase this is not one of the four known environment branches."; + echo "Setting DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME to be ${{ vars.DEVOPS_ENV_NAME_DEV }}"; + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ vars.DEVOPS_ENV_NAME_DEV }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_IS_FEATURE_BRANCH to 'true' becuase this is not one of the four named environment branches."; echo "DEVOPS_IS_FEATURE_BRANCH=true" >> $GITHUB_OUTPUT; + echo "DEVOPS_IS_ENV_DEV=true" >> $GITHUB_OUTPUT; fi; - - name: Echo DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME - run: echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" - - - name: Echo DEVOPS_IS_FEATURE_BRANCH - run: echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" - - - jira-vars: - runs-on: ubuntu-latest - needs: [env-vars] - outputs: - DEVOPS_JIRA_TICKET_ID: ${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} - steps: - - name: Echo Version + - name: Echo Deployment Env Vars + id: echo-deployment-define-outputs run: | - echo 'devops-vars v1.3.0' + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" + echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" + echo "DEVOPS_IS_ENV_DEV=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEV }}" + echo "DEVOPS_IS_ENV_UAT=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_UAT }}" + echo "DEVOPS_IS_ENV_DEMO=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }}" + echo "DEVOPS_IS_ENV_PROD=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_PROD }}" - name: Extract JIRA Prefix to Variable DEVOPS_JIRA_TICKET_ID id: extract-jira-ticket-id @@ -132,7 +120,7 @@ jobs: run: | #!/bin/bash # Set to "N/A" if not a feature branch - if [ ${{ needs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then + if [ ${{ needs.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then echo "DEVOPS_JIRA_TICKET_ID=N/A" >> $GITHUB_OUTPUT; else refname=$GITHUB_BRANCH_NAME @@ -151,28 +139,17 @@ jobs: - name: Echo DEVOPS_JIRA_TICKET_ID run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" - - branch-vars: - runs-on: ubuntu-latest - needs: [env-vars, jira-vars] - outputs: - DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} - steps: - - name: Echo Version - run: | - echo 'devops-vars v1.3.0' - - name: Determine Branch Env Name based upon DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME and DEVOPS_IS_FEATURE_BRANCH id: determine-branch-env-name shell: bash run: | #!/bin/bash - if [ ${{ needs.env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then + if [ ${{ steps.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; else echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ needs.env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.define-outputs.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; fi; - name: Echo DEVOPS_BRANCH_ENV_NAME From 19c4b5454610554ddabbe8787b6abbd23bdc4839 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 14:26:33 -0600 Subject: [PATCH 11/15] Update github action job names and ids --- .github/workflows/devops-vars.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 20599c9..8385e16 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -44,7 +44,7 @@ jobs: run: | echo 'devops-vars v1.3.0' - - name: Determine value of variable DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME + - name: Determine value of DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME id: determine-deployment-env env: GITHUB_BRANCH_NAME: ${{ github.ref_name }} @@ -102,8 +102,8 @@ jobs: echo "DEVOPS_IS_ENV_DEV=true" >> $GITHUB_OUTPUT; fi; - - name: Echo Deployment Env Vars - id: echo-deployment-define-outputs + - name: Echo Deployment Environment Vars + id: echo-deployment-env-vars run: | echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" @@ -112,7 +112,7 @@ jobs: echo "DEVOPS_IS_ENV_DEMO=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }}" echo "DEVOPS_IS_ENV_PROD=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_PROD }}" - - name: Extract JIRA Prefix to Variable DEVOPS_JIRA_TICKET_ID + - name: Extract JIRA Prefix to DEVOPS_JIRA_TICKET_ID id: extract-jira-ticket-id env: GITHUB_BRANCH_NAME: ${{ github.ref_name }} @@ -137,9 +137,10 @@ jobs: fi; - name: Echo DEVOPS_JIRA_TICKET_ID + id: echo-jira-ticket-id run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" - - name: Determine Branch Env Name based upon DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME and DEVOPS_IS_FEATURE_BRANCH + - name: Determine DEVOPS_BRANCH_ENV_NAME based upon DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME and DEVOPS_IS_FEATURE_BRANCH id: determine-branch-env-name shell: bash run: | @@ -153,4 +154,5 @@ jobs: fi; - name: Echo DEVOPS_BRANCH_ENV_NAME + id: echo-branch-env-name run: echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }}" From 4155987efccbbc6c4ddfb2e6e74896fae4b5b185 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 15:43:04 -0600 Subject: [PATCH 12/15] Update to allow input flag --- .github/workflows/devops-vars.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 8385e16..74a954e 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -1,5 +1,10 @@ on: workflow_call: + inputs: + DEPLOY_FEATURE_BRANCHES: + description: "A true/false (boolean) flag that can be used to enable the deployment of feature branches (if set to true)." + type: boolean + default: false outputs: DEVOPS_BRANCH_ENV_NAME: description: "A value to append to CloudFormation stack names and AWS resource names for the purpose of unique names." @@ -8,19 +13,19 @@ on: description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." value: ${{ jobs.define-outputs.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} DEVOPS_IS_ENV_DEV: - description: "A true/false flag that indicates whether the current GitHub branch will target the 'DEV' deployment environment." + description: "A true/false (string) flag that indicates whether the current GitHub branch will target the 'DEV' deployment environment." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_DEV }} DEVOPS_IS_ENV_UAT: - description: "A true/false flag that indicates whether the current GitHub branch will target the 'UAT' deployment environment." + description: "A true/false (string) flag that indicates whether the current GitHub branch will target the 'UAT' deployment environment." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_UAT }} DEVOPS_IS_ENV_DEMO: - description: "A true/false flag that indicates whether the current GitHub branch will target the 'DEMO' deployment environment." + description: "A true/false (string) flag that indicates whether the current GitHub branch will target the 'DEMO' deployment environment." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_DEMO }} DEVOPS_IS_ENV_PROD: - description: "A true/false flag that indicates whether the current GitHub branch will target the 'PROD' deployment environment." + description: "A true/false (string) flag that indicates whether the current GitHub branch will target the 'PROD' deployment environment." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_PROD }} DEVOPS_IS_FEATURE_BRANCH: - description: "A true/false flag that indicates whether the current GitHub branch is a feature branch or not. It is determined to be a feature branch if the branch name is not one of: 'develop', 'uat', 'demo', 'main'." + description: "A true/false (string) flag that indicates whether the current GitHub branch is a feature branch or not. It is determined to be a feature branch if the branch name is not one of: 'develop', 'uat', 'demo', 'main'." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} DEVOPS_JIRA_TICKET_ID: description: "The JIRA Ticket ID that was found within the branch name. Only expect a value when DEVOPS_IS_FEATURE_BRANCH is true. Defaults to 'N/A' in the case one doesn't exist in the branch name or isn't a feature branch." @@ -33,6 +38,7 @@ jobs: outputs: DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: ${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_DEPLOY_FEATURE_BRANCHES: ${{ steps.determine-deployment-env.outputs.DEVOPS_DEPLOY_FEATURE_BRANCHES }} DEVOPS_IS_ENV_DEV: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEV }} DEVOPS_IS_ENV_UAT: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_UAT }} DEVOPS_IS_ENV_DEMO: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }} @@ -58,6 +64,9 @@ jobs: refname=$GITHUB_BRANCH_NAME echo "Branch Ref is ${GITHUB_BRANCH_NAME}" + # Set the variable that was passed into this workflows + echo "DEVOPS_DEPLOY_FEATURE_BRANCHES=${{ inputs.DEPLOY_FEATURE_BRANCHES }}" >> $GITHUB_OUTPUT; + # These are the special branch names that indicate the environment we are deploying to. reDev=${BRANCH_NAME_DEV} echo "Branch Name Dev = ${BRANCH_NAME_DEV}" From 30597a9a71b9ddff53213c53d60b0a169eb631b9 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 15:45:57 -0600 Subject: [PATCH 13/15] Update github vars --- .github/workflows/devops-vars.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 74a954e..f79894e 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -12,6 +12,9 @@ on: DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: description: "The name of the current deployment environment. That is one of: dev, uat, demo, or prod. This is used to determine what AWS account to deploy into." value: ${{ jobs.define-outputs.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_DEPLOY_FEATURE_BRANCHES: + description: "A true/false (string) flag that can be used to enable the deployment of feature branches (if set to true)." + value: ${{ jobs.define-outputs.outputs.DEVOPS_DEPLOY_FEATURE_BRANCHES }} DEVOPS_IS_ENV_DEV: description: "A true/false (string) flag that indicates whether the current GitHub branch will target the 'DEV' deployment environment." value: ${{ jobs.define-outputs.outputs.DEVOPS_IS_ENV_DEV }} From 73fd6fcb380e137d4fc7d77987404e5d9fb656c5 Mon Sep 17 00:00:00 2001 From: Matt S Date: Thu, 31 Aug 2023 16:49:38 -0600 Subject: [PATCH 14/15] Update vars --- .github/workflows/devops-vars.yml | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index f79894e..d77dd47 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -39,22 +39,22 @@ jobs: define-outputs: runs-on: ubuntu-latest outputs: - DEVOPS_BRANCH_ENV_NAME: ${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} - DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: ${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} - DEVOPS_DEPLOY_FEATURE_BRANCHES: ${{ steps.determine-deployment-env.outputs.DEVOPS_DEPLOY_FEATURE_BRANCHES }} - DEVOPS_IS_ENV_DEV: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEV }} - DEVOPS_IS_ENV_UAT: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_UAT }} - DEVOPS_IS_ENV_DEMO: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }} - DEVOPS_IS_ENV_PROD: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_PROD }} - DEVOPS_IS_FEATURE_BRANCH: ${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }} - DEVOPS_JIRA_TICKET_ID: ${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} + DEVOPS_BRANCH_ENV_NAME: ${{ steps.set-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }} + DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }} + DEVOPS_DEPLOY_FEATURE_BRANCHES: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_DEPLOY_FEATURE_BRANCHES }} + DEVOPS_IS_ENV_DEV: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_DEV }} + DEVOPS_IS_ENV_UAT: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_UAT }} + DEVOPS_IS_ENV_DEMO: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_DEMO }} + DEVOPS_IS_ENV_PROD: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_PROD }} + DEVOPS_IS_FEATURE_BRANCH: ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} + DEVOPS_JIRA_TICKET_ID: ${{ steps.set-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }} steps: - name: Echo Version run: | echo 'devops-vars v1.3.0' - name: Determine value of DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME - id: determine-deployment-env + id: set-deployment-env-vars env: GITHUB_BRANCH_NAME: ${{ github.ref_name }} BRANCH_NAME_DEV: ${{ vars.DEVOPS_BRANCH_NAME_DEV }} @@ -117,22 +117,22 @@ jobs: - name: Echo Deployment Environment Vars id: echo-deployment-env-vars run: | - echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.determine-deployment-env.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" - echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_FEATURE_BRANCH }}" - echo "DEVOPS_IS_ENV_DEV=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEV }}" - echo "DEVOPS_IS_ENV_UAT=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_UAT }}" - echo "DEVOPS_IS_ENV_DEMO=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_DEMO }}" - echo "DEVOPS_IS_ENV_PROD=${{ steps.determine-deployment-env.outputs.DEVOPS_IS_ENV_PROD }}" + echo "DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME=${{ steps.set-deployment-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" + echo "DEVOPS_IS_FEATURE_BRANCH=${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }}" + echo "DEVOPS_IS_ENV_DEV=${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_DEV }}" + echo "DEVOPS_IS_ENV_UAT=${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_UAT }}" + echo "DEVOPS_IS_ENV_DEMO=${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_DEMO }}" + echo "DEVOPS_IS_ENV_PROD=${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_ENV_PROD }}" - - name: Extract JIRA Prefix to DEVOPS_JIRA_TICKET_ID - id: extract-jira-ticket-id + - name: Determine value of DEVOPS_JIRA_TICKET_ID + id: set-jira-ticket-id env: GITHUB_BRANCH_NAME: ${{ github.ref_name }} shell: bash run: | #!/bin/bash # Set to "N/A" if not a feature branch - if [ ${{ needs.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then + if [ ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = 'false' ]; then echo "DEVOPS_JIRA_TICKET_ID=N/A" >> $GITHUB_OUTPUT; else refname=$GITHUB_BRANCH_NAME @@ -150,21 +150,21 @@ jobs: - name: Echo DEVOPS_JIRA_TICKET_ID id: echo-jira-ticket-id - run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.extract-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" + run: echo "DEVOPS_JIRA_TICKET_ID=${{ steps.set-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" - name: Determine DEVOPS_BRANCH_ENV_NAME based upon DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME and DEVOPS_IS_FEATURE_BRANCH - id: determine-branch-env-name + id: set-branch-env-name shell: bash run: | #!/bin/bash - if [ ${{ steps.define-outputs.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then + if [ ${{ steps.set-deployment-env-vars.outputs.DEVOPS_IS_FEATURE_BRANCH }} = true ]; then echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.jira-vars.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; + echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.set-jira-ticket-id.outputs.DEVOPS_JIRA_TICKET_ID }}" >> $GITHUB_OUTPUT; else - echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_JIRA_TICKET_ID"; - echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.define-outputs.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; + echo "Setting DEVOPS_ENV_NAME to be equal to DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME"; + echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.set-deployment-env-vars.outputs.DEVOPS_CURRENT_DEPLOYMENT_ENV_NAME }}" >> $GITHUB_OUTPUT; fi; - name: Echo DEVOPS_BRANCH_ENV_NAME id: echo-branch-env-name - run: echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.determine-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }}" + run: echo "DEVOPS_BRANCH_ENV_NAME=${{ steps.set-branch-env-name.outputs.DEVOPS_BRANCH_ENV_NAME }}" From 96feb555daa7f629697ee057760a4116e870c088 Mon Sep 17 00:00:00 2001 From: Matt S Date: Tue, 5 Sep 2023 11:19:02 -0600 Subject: [PATCH 15/15] Update to make the extracted JIRA ticket ID be lowercase --- .github/workflows/devops-vars.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/devops-vars.yml b/.github/workflows/devops-vars.yml index 306bdbe..fb8cc41 100644 --- a/.github/workflows/devops-vars.yml +++ b/.github/workflows/devops-vars.yml @@ -141,7 +141,9 @@ jobs: echo "Checking if branch name contains a JIRA issue (format MID-1234, AN-1 or similar)" if [[ $refname =~ $re ]]; then echo "JIRA Ticket ID found within ${refname}"; - echo "DEVOPS_JIRA_TICKET_ID=$(echo ${BASH_REMATCH[0]})" >> $GITHUB_OUTPUT; + DEVOPS_JIRA_TICKET_ID_POSSIBLY_UPPERCASE=${BASH_REMATCH[0]} + DEVOPS_JIRA_TICKET_ID_LOWERCASE=${DEVOPS_JIRA_TICKET_ID_POSSIBLY_UPPERCASE,,} + echo "DEVOPS_JIRA_TICKET_ID=$(echo ${DEVOPS_JIRA_TICKET_ID_LOWERCASE})" >> $GITHUB_OUTPUT; else echo "Malformed Branch Name: ${refname} does not contain a JIRA Ticket ID and is not a known env specific branch."; exit 1;