5252 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id }}
5353
5454 - name : Add S3 Permissions to Lambda
55+ env :
56+ ENVIRONMENT : ${{ inputs.environment }}
5557 run : |
56- account=$(echo '${{ inputs.environment }}' | cut -d '-' -f1)
57- inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
58+ account=$(echo "$ENVIRONMENT" | cut -d '-' -f1)
59+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
5860 make get-s3-perms ENV=${account} TF_WORKSPACE_NAME=${inactive_stack}
5961
6062 - name : Save Build Artifacts
9698 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id }}
9799
98100 - name : Retrieve Server Certificates
101+ env :
102+ ENVIRONMENT : ${{ inputs.environment }}
99103 run : |
100- account=$(echo '${{ inputs.environment }}' | cut -d '-' -f1)
104+ account=$(echo "$ENVIRONMENT" | cut -d '-' -f1)
101105 make truststore-pull-server ENV=${account}
102106
103107 - name : Download build artifacts
@@ -114,28 +118,33 @@ jobs:
114118 fail-on-cache-miss : true
115119
116120 - name : Terraform Init
121+ env :
122+ ENVIRONMENT : ${{ inputs.environment }}
117123 run : |
118- inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
124+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
119125 terraform -chdir=terraform/infrastructure init
120126 terraform -chdir=terraform/infrastructure workspace new ${inactive_stack} || \
121127 terraform -chdir=terraform/infrastructure workspace select ${inactive_stack}
122128
123129 - name : Terraform Plan
124130 env :
125131 DEPLOY_ROLE_ARN : ${{ secrets.DEPLOY_ROLE_ARN }}
132+ ENVIRONMENT : ${{ inputs.environment }}
126133 run : |
127- inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
134+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
128135 terraform -chdir=terraform/infrastructure plan \
129136 --var-file=etc/${{ vars.ACCOUNT_NAME }}.tfvars \
130137 --var assume_role_arn=${DEPLOY_ROLE_ARN} \
131138 --var use_shared_resources=$(poetry run python scripts/are_resources_shared_for_stack.py ${inactive_stack}) \
132139 -out tfplan
133140
134141 - name : Save Terraform Plan
142+ env :
143+ ENVIRONMENT : ${{ inputs.environment }}
135144 run : |
136145 terraform -chdir=terraform/infrastructure show -no-color tfplan > terraform/infrastructure/tfplan.txt
137- aws s3 cp terraform/infrastructure/tfplan s3://nhsd-nrlf--mgmt--github-ci-logging/${{ inputs.environment }} /${{ github.run_id }}/tfplan
138- aws s3 cp terraform/infrastructure/tfplan.txt s3://nhsd-nrlf--mgmt--github-ci-logging/${{ inputs.environment }} /${{ github.run_id }}/tfplan.txt
146+ aws s3 cp terraform/infrastructure/tfplan s3://nhsd-nrlf--mgmt--github-ci-logging/$ENVIRONMENT /${{ github.run_id }}/tfplan
147+ aws s3 cp terraform/infrastructure/tfplan.txt s3://nhsd-nrlf--mgmt--github-ci-logging/$ENVIRONMENT /${{ github.run_id }}/tfplan.txt
139148
140149 terraform-apply :
141150 name : Terraform Apply - ${{ inputs.environment }}
@@ -175,16 +184,22 @@ jobs:
175184 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
176185
177186 - name : Download Terraform Plan artifact
178- run : aws s3 cp s3://nhsd-nrlf--mgmt--github-ci-logging/${{ inputs.environment }}/${{ github.run_id }}/tfplan terraform/infrastructure/tfplan
187+ env :
188+ ENVIRONMENT : ${{ inputs.environment }}
189+ run : aws s3 cp s3://nhsd-nrlf--mgmt--github-ci-logging/$ENVIRONMENT/${{ github.run_id }}/tfplan terraform/infrastructure/tfplan
179190
180191 - name : Retrieve Server Certificates
192+ env :
193+ ENVIRONMENT : ${{ inputs.environment }}
181194 run : |
182- account=$(echo '${{ inputs.environment }}' | cut -d '-' -f1)
195+ account=$(echo "$ENVIRONMENT" | cut -d '-' -f1)
183196 make truststore-pull-server ENV=${account}
184197
185198 - name : Terraform Init
199+ env :
200+ ENVIRONMENT : ${{ inputs.environment }}
186201 run : |
187- inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
202+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
188203 terraform -chdir=terraform/infrastructure init
189204 terraform -chdir=terraform/infrastructure workspace new ${inactive_stack} || \
190205 terraform -chdir=terraform/infrastructure workspace select ${inactive_stack}
@@ -193,15 +208,19 @@ jobs:
193208 run : terraform -chdir=terraform/infrastructure apply tfplan
194209
195210 - name : Update environment config version
211+ env :
212+ ENVIRONMENT : ${{ inputs.environment }}
196213 run : |
197214 deployed_version=$(terraform -chdir=terraform/infrastructure output --raw version)
198- poetry run python ./scripts/set_env_config.py inactive-version ${deployed_version} ${{ inputs.environment }}
215+ poetry run python ./scripts/set_env_config.py inactive-version ${deployed_version} $ENVIRONMENT
199216
200217 - name : Smoke Test
218+ env :
219+ ENVIRONMENT : ${{ inputs.environment }}
201220 run : |
202- account=$(echo '${{ inputs.environment }}' | cut -d '-' -f1)
221+ account=$(echo "$ENVIRONMENT" | cut -d '-' -f1)
203222 make ENV=${account} truststore-pull-client
204- make ENV=${{ inputs.environment }} test-smoke-internal
223+ make ENV=$ENVIRONMENT test-smoke-internal
205224
206225 activate-stack :
207226 name : Activate - ${{ inputs.environment }}
@@ -228,9 +247,11 @@ jobs:
228247 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
229248
230249 - name : Activate Stack
250+ env :
251+ ENVIRONMENT : ${{ inputs.environment }}
231252 run : |
232- inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
233- poetry run python ./scripts/activate_stack.py ${inactive_stack} ${{ inputs.environment }}
253+ inactive_stack=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
254+ poetry run python ./scripts/activate_stack.py ${inactive_stack} $ENVIRONMENT
234255
235256 post-release-verify :
236257 name : Verify - ${{ inputs.environment }}
@@ -257,8 +278,10 @@ jobs:
257278 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
258279
259280 - name : " Smoke Test"
281+ env :
282+ ENVIRONMENT : ${{ inputs.environment }}
260283 run : |
261- make ENV=${{ inputs.environment }} test-smoke-public
284+ make ENV=$ENVIRONMENT test-smoke-public
262285
263286 rollback-stack :
264287 name : Rollback - ${{ inputs.environment }}
@@ -286,6 +309,8 @@ jobs:
286309 role-session-name : github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
287310
288311 - name : Deactivate Stack
312+ env :
313+ ENVIRONMENT : ${{ inputs.environment }}
289314 run : |
290- inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack ${{ inputs.environment }} )
291- poetry run python ./scripts/activate_stack.py ${inactive_stack_name} ${{ inputs.environment }}
315+ inactive_stack_name=$(poetry run python ./scripts/get_env_config.py inactive-stack $ENVIRONMENT )
316+ poetry run python ./scripts/activate_stack.py ${inactive_stack_name} $ENVIRONMENT
0 commit comments