Skip to content

Commit e4b9289

Browse files
ELI 442: fix - steps order correction in preprod deployment pipeline (#433)
* ELI 442: fix - steps order correction in preprod deployment pipeline * ELI 442: fix - steps order correction in preprod deployment pipeline * ELI 442: fix - steps order correction in preprod deployment pipeline * ELI 442: correct env name * ELI 442: lambda artifact management
1 parent efefa09 commit e4b9289

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.github/workflows/base-deploy.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
6868
export REF="${{ steps.variables.outputs.ref }}"
6969
export ENVIRONMENT="${{ steps.variables.outputs.environment }}"
70+
export PROMOTED_ENVIRONMENT="${{ steps.variables.outputs.promoted_environment }}"
7071
echo "build_datetime=$BUILD_DATETIME"
7172
echo "build_timestamp=$BUILD_TIMESTAMP"
7273
echo "build_epoch=$BUILD_EPOCH"
@@ -75,6 +76,7 @@ jobs:
7576
echo "terraform_version=$TERRAFORM_VERSION"
7677
echo "ref=$REF"
7778
echo "environment=$ENVIRONMENT"
79+
echo "promoted_environment=$PROMOTED_ENVIRONMENT"
7880
7981
- name: "Resolve the dev-* tag for this commit"
8082
id: tag
@@ -117,12 +119,26 @@ jobs:
117119
ref: ${{ needs.metadata.outputs.ref }}
118120
fetch-depth: 0
119121

122+
- name: "Setup Terraform"
123+
uses: hashicorp/setup-terraform@v3
124+
with:
125+
terraform_version: ${{ needs.metadata.outputs.terraform_version }}
126+
120127
- name: "Configure AWS Credentials"
121128
uses: aws-actions/configure-aws-credentials@v5
122129
with:
123130
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
124131
aws-region: eu-west-2
125132

133+
- name: "Terraform Init"
134+
env:
135+
ENVIRONMENT: ${{ needs.metadata.outputs.promoted_environment }}
136+
WORKSPACE: "default"
137+
run: |
138+
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=api-layer tf-command=init"
139+
make terraform env=$ENVIRONMENT stack=api-layer tf-command=init workspace=$WORKSPACE
140+
working-directory: ./infrastructure
141+
126142
- name: "Extract S3 bucket name from Terraform output"
127143
id: tf_output
128144
run: |
@@ -147,7 +163,7 @@ jobs:
147163
deploy:
148164
name: "Deploy to ${{ needs.metadata.outputs.environment }}"
149165
runs-on: ubuntu-latest
150-
needs: [metadata]
166+
needs: [metadata, download-lambda-artifact]
151167
timeout-minutes: 45
152168
permissions:
153169
id-token: write

DEPLOYMENT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ Releases are immutable and auditable:
2626

2727
> **Note:** The Preprod/prod entry workflows are thin wrappers around a **reusable** workflow (`base-deploy.yml`).
2828
29+
### Lambda Artifact management
30+
31+
1. `Dev deploy` → artifact is created and stored in GitHub actions.
32+
2. `Test deploy` → downloads the artifact from GitHub actions, uploads it to `Test` S3 and deploys to lambda.
33+
3. `Preprod deploy` → downloads the artifact from `Test` S3, uploads it to `Preprod` S3 and deploys to lambda.
34+
4. `Prod deploy` → downloads the artifact from `Preprod` s3, uploads it to `Prod` S3 and deploys to lambda.
35+
2936
---
3037

3138
## Pull Request Workflow (CI)

0 commit comments

Comments
 (0)