Skip to content

Commit 168e9c4

Browse files
committed
VED-812: Add e2e test pipeline.
1 parent 87960ca commit 168e9c4

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Run e2e Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
apigee_environment:
7+
required: true
8+
type: string
9+
environment:
10+
required: true
11+
type: string
12+
sub_environment:
13+
required: true
14+
type: string
15+
workflow_dispatch:
16+
inputs:
17+
apigee_environment:
18+
type: choice
19+
description: Select the Apigee proxy environment
20+
options:
21+
- internal-dev
22+
- int
23+
- ref
24+
- prod
25+
environment:
26+
type: string
27+
description: Select the backend environment
28+
options:
29+
- dev
30+
- preprod
31+
- prod
32+
sub_environment:
33+
type: string
34+
description: Set the sub environment name e.g. pr-xxx, or green/blue in higher environments
35+
36+
jobs:
37+
e2e-tests:
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: ${{ inputs.environment }}
41+
env: # Sonarcloud - do not allow direct usage of untrusted data
42+
APIGEE_ENVIRONMENT: ${{ inputs.apigee_environment }}
43+
BACKEND_ENVIRONMENT: ${{ inputs.environment }}
44+
BACKEND_SUB_ENVIRONMENT: ${{ inputs.sub_environment }}
45+
APIGEE_USERNAME: ${{ vars.APIGEE_USERNAME }}
46+
permissions:
47+
id-token: write
48+
contents: read
49+
steps:
50+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
51+
52+
- name: Install poetry
53+
run: pip install poetry==2.1.4
54+
55+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
56+
with:
57+
python-version: 3.11
58+
cache: "poetry"
59+
60+
- name: Install e2e test dependencies
61+
run: poetry install --no-root
62+
working-directory: e2e
63+
64+
- name: Install oathtool
65+
run: sudo apt-get update && sudo apt-get install -y oathtool
66+
67+
- name: Get Apigee access token
68+
env:
69+
APIGEE_PASSWORD: ${{ secrets.APIGEE_PASSWORD }}
70+
APIGEE_OAUTH_TOKEN: ${{ secrets.APIGEE_BASIC_AUTH_TOKEN }}
71+
APIGEE_OTP_SECRET: ${{ secrets.APIGEE_OTP_KEY }}
72+
run: |
73+
CODE=$(oathtool --totp -b "$APIGEE_OTP_SECRET")
74+
echo "::add-mask::$CODE"
75+
echo "Requesting access token from Apigee..."
76+
response=$(curl -s -X POST "https://login.apigee.com/oauth/token" \
77+
-H "Content-Type: application/x-www-form-urlencoded" \
78+
-H "Accept: application/json;charset=utf-8" \
79+
-H "Authorization: Basic $APIGEE_BASIC_AUTH_TOKEN" \
80+
-d "username=$APIGEE_USERNAME&password=$APIGEE_PASSWORD&mfa_token=$CODE&grant_type=password")
81+
token=$(echo "$response" | jq -e -r '.access_token')
82+
if [[ -z "$token" ]]; then
83+
echo "Failed to retrieve access token"
84+
exit 1
85+
fi
86+
echo "::add-mask::$token"
87+
echo "APIGEE_ACCESS_TOKEN=$token" >> $GITHUB_ENV
88+
89+
- name: Run e2e tests
90+
working-directory: e2e
91+
env:
92+
# APIGEE_USERNAME: [email protected]
93+
run: |
94+
# export PROXY_NAME=immunisation-fhir-api-${{ inputs.sub_environment }}
95+
# export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4-${{ inputs.sub_environment }}
96+
export PROXY_NAME=immunisation-fhir-api-internal-dev
97+
export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4
98+
make run-immunization

0 commit comments

Comments
 (0)