Skip to content

Commit 936b200

Browse files
committed
ELI-452: tag creation done
1 parent 8d8e43b commit 936b200

File tree

2 files changed

+76
-31
lines changed

2 files changed

+76
-31
lines changed

.github/workflows/base-deploy.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,19 @@ jobs:
8989
with:
9090
terraform_version: ${{ needs.metadata.outputs.terraform_version }}
9191

92+
- name: "Install Poetry"
93+
run: |
94+
curl -sSL https://install.python-poetry.org | python3 -
95+
echo "$HOME/.local/bin" >> $GITHUB_PATH
96+
9297
- name: "Set up Python"
9398
uses: actions/setup-python@v5
9499
with:
95100
python-version: "3.13"
101+
cache: 'poetry'
102+
103+
- name: "Install dependencies"
104+
run: poetry install
96105

97106
- name: "Checkout repository at ref"
98107
uses: actions/checkout@v5
@@ -144,8 +153,6 @@ jobs:
144153
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=api-layer tf-command=apply"
145154
make terraform env=$ENVIRONMENT stack=api-layer tf-command=apply workspace=$WORKSPACE
146155
147-
- run: poetry install
148-
149156
- name: "Tag and Release"
150157
if: ${{ needs.metadata.outputs.environment == 'preprod' || needs.metadata.outputs.environment == 'prod' }}
151158
env:
@@ -154,7 +161,7 @@ jobs:
154161
INPUT_RELEASE_TYPE: ${{ inputs.release_type }}
155162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156163
GITHUB_REPOSITORY: ${{ github.repository }}
157-
run: python scripts/seed_users/tag_and_release.py
164+
run: poetry run python scripts/seed_users/tag_and_release.py
158165

159166

160167
regression-tests:

.github/workflows/cicd-3-test.yaml

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,30 @@
33

44
name: "CI/CD deploy to TEST"
55

6+
concurrency:
7+
group: terraform-deploy-${{ github.event.inputs.environment }}
8+
cancel-in-progress: false
9+
610
on:
711
workflow_dispatch:
812
inputs:
913
tag:
10-
description: "Branch/Tag/SHA to deploy to test"
14+
description: "This is the tag that is going to be deployed"
1115
required: true
12-
default: "feauture/te-sd-ELI-452-cicd-improvements"
13-
release_type:
14-
description: "Version bump type (use 'rc' to keep the same base and just increment RC)"
16+
default: "latest"
17+
environment:
18+
description: "Target environment (test only)"
1519
required: true
16-
default: "rc"
20+
default: "test"
1721
type: choice
1822
options:
19-
- rc
20-
- patch
21-
- minor
22-
- major
23+
- test
2324

2425
jobs:
2526
metadata:
2627
name: "Set CI/CD metadata"
2728
runs-on: ubuntu-latest
28-
timeout-minutes: 10
29+
timeout-minutes: 1
2930
outputs:
3031
build_datetime: ${{ steps.variables.outputs.build_datetime }}
3132
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
@@ -66,38 +67,75 @@ jobs:
6667
export TAG="${{ steps.variables.outputs.tag }}"
6768
make list-variables
6869
deploy:
69-
name: "Deploy to test environment"
70+
name: "Deploy to an environment"
7071
runs-on: ubuntu-latest
7172
needs: [metadata]
72-
timeout-minutes: 10080
73+
environment: ${{ inputs.environment }}
74+
timeout-minutes: 30
7375
permissions:
7476
id-token: write
7577
contents: write
7678
steps:
79+
- name: "Setup Terraform"
80+
uses: hashicorp/setup-terraform@v3
81+
with:
82+
terraform_version: ${{ needs.metadata.outputs.terraform_version }}
83+
84+
- name: "Set up Python"
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: "3.13"
88+
7789
- name: "Checkout Repository"
7890
uses: actions/checkout@v5
7991
with:
8092
ref: ${{ github.event.inputs.tag }}
8193

82-
- name: "Install Poetry"
94+
- name: "Build lambda artefact"
8395
run: |
84-
curl -sSL https://install.python-poetry.org | python3 -
85-
echo "$HOME/.local/bin" >> $GITHUB_PATH
96+
make dependencies install-python
97+
make build
8698
87-
- name: "Set up Python"
88-
uses: actions/setup-python@v5
99+
- name: "Upload lambda artefact"
100+
uses: actions/upload-artifact@v4
89101
with:
90-
python-version: "3.13"
91-
cache: 'poetry'
102+
name: lambda
103+
path: dist/lambda.zip
104+
105+
- name: "Download Built Lambdas"
106+
uses: actions/download-artifact@v5
107+
with:
108+
name: lambda
109+
path: ./build
92110

93-
- name: "Install dependencies"
94-
run: poetry install
111+
- name: "Configure AWS Credentials"
112+
uses: aws-actions/configure-aws-credentials@v5
113+
with:
114+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
115+
aws-region: eu-west-2
95116

96-
- name: "Manage Release"
117+
- name: "Terraform Apply"
97118
env:
98-
ENVIRONMENT: 'preprod'
99-
REF: ${{ needs.metadata.outputs.tag }}
100-
INPUT_RELEASE_TYPE: ${{ inputs.release_type }}
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
GITHUB_REPOSITORY: ${{ github.repository }}
103-
run: poetry run python scripts/seed_users/tag_and_release.py
119+
ENVIRONMENT: ${{ inputs.environment }}
120+
WORKSPACE: "default"
121+
TF_VAR_API_CA_CERT: ${{ secrets.API_CA_CERT }}
122+
TF_VAR_API_CLIENT_CERT: ${{ secrets.API_CLIENT_CERT }}
123+
TF_VAR_API_PRIVATE_KEY_CERT: ${{ secrets.API_PRIVATE_KEY_CERT }}
124+
TF_VAR_SPLUNK_HEC_TOKEN: ${{ secrets.SPLUNK_HEC_TOKEN }}
125+
TF_VAR_SPLUNK_HEC_ENDPOINT: ${{ secrets.SPLUNK_HEC_ENDPOINT }}
126+
run: |
127+
mkdir -p ./build
128+
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=networking tf-command=apply"
129+
make terraform env=$ENVIRONMENT stack=networking tf-command=apply workspace=$WORKSPACE
130+
echo "Running: make terraform env=$ENVIRONMENT workspace=$WORKSPACE stack=api-layer tf-command=apply"
131+
make terraform env=$ENVIRONMENT stack=api-layer tf-command=apply workspace=$WORKSPACE
132+
working-directory: ./infrastructure
133+
134+
regression-tests:
135+
name: "Regression Tests"
136+
needs: deploy
137+
uses: ./.github/workflows/regression-tests.yml
138+
with:
139+
ENVIRONMENT: "test"
140+
VERSION_NUMBER: "main"
141+
secrets: inherit

0 commit comments

Comments
 (0)