4444 make plan environment=${{ inputs.environment }} aws_account_name=int
4545
4646 terraform-apply :
47+ if : ${{ vars.SKIP_APPLY != 'true' }}
4748 needs : terraform-plan
4849 runs-on : ubuntu-latest
4950 permissions :
@@ -74,11 +75,11 @@ jobs:
7475 - name : Terraform Apply
7576 working-directory : ${{ vars.TERRAFORM_DIR_PATH }}
7677 run : |
77- make apply environment=${{ inputs.environment }} aws_account_name=int
78+ make plan environment=${{ inputs.environment }} aws_account_name=int
7879
7980 e2e-tests :
80- needs : terraform-apply
81- if : ${{ vars.RUN_E2E == 'true' || inputs.environment == vars.ACTIVE_ENVIRONMENT }}
81+ # needs: terraform-apply
82+ if : ${{ vars.RUN_E2E == 'true' && inputs.environment == vars.ACTIVE_ENVIRONMENT }}
8283 runs-on : ubuntu-latest
8384 permissions :
8485 id-token : write
@@ -96,44 +97,64 @@ jobs:
9697 - name : Set up Python
9798 uses : actions/setup-python@v5
9899 with :
99- python-version : " 3.11 "
100+ python-version : " 3.10 "
100101
101102 - name : Install Poetry
102103 run : |
103- curl -sSL https://install.python-poetry.org | python3 -
104+ curl -sSL https://install.python-poetry.org | python3 - --version 2.1.2
104105 echo "$HOME/.local/bin" >> $GITHUB_PATH
106+ poetry --version
105107
106- - name : Set Poetry to use Python 3.11
108+ - name : Set Poetry to use Python 3.10
107109 working-directory : ${{ vars.E2E_DIR_PATH }}
108110 run : |
109- poetry env use $(which python3.11 )
111+ poetry env use $(which python3.10 )
110112
111113 - name : Install dependencies with Poetry
112114 working-directory : ${{ vars.E2E_DIR_PATH }}
113115 run : |
114116 poetry install --no-root
115117
118+ - name : Install oathtool
119+ run : sudo apt-get update && sudo apt-get install -y oathtool
120+
121+ - name : Get JWT token for apigee
122+ env :
123+ APIGEE_USERNAME : ${{ vars.APIGEE_USERNAME }}
124+ APIGEE_PASSWORD : ${{ secrets.APIGEE_PASSWORD }}
125+ MFA_CODE : ${{ env.MFA_CODE }}
126+ APIGEE_OAUTH_TOKEN : ${{ secrets.APIGEE_OAUTH_TOKEN }}
127+ OTP_SECRET : ${{ secrets.APIGEE_OTP_KEY }}
128+ run : |
129+ CODE=$(oathtool --totp -b "$OTP_SECRET")
130+ echo "::add-mask::$CODE"
131+
132+ echo "Requesting access token from Apigee..."
133+
134+ response=$(curl -s -X POST "https://login.apigee.com/oauth/token" \
135+ -H "Content-Type: application/x-www-form-urlencoded" \
136+ -H "Accept: application/json;charset=utf-8" \
137+ -H "Authorization: Basic $APIGEE_OAUTH_TOKEN" \
138+ -d "username=$APIGEE_USERNAME&password=$APIGEE_PASSWORD&mfa_token=$CODE&grant_type=password")
139+
140+ token=$(echo "$response" | jq -r '.access_token // empty')
141+
142+ if [[ -z "$token" ]]; then
143+ echo "Failed to retrieve access token"
144+ exit 1
145+ fi
146+
147+ echo "::add-mask::$token"
148+ echo "APIGEE_ACCESS_TOKEN=$token" >> $GITHUB_ENV
149+
116150 - name : Run e2e tests
117151 working-directory : ${{ vars.E2E_DIR_PATH }}
152+ env :
153+ APIGEE_ACCESS_TOKEN : ${{ env.APIGEE_ACCESS_TOKEN }}
154+ APIGEE_USERNAME :
[email protected] 118155 run : |
119- apigee_token=$(aws ssm get-parameter \
120- --name "/imms/apigee/non-prod/token" \
121- --with-decryption \
122- --query "Parameter.Value" \
123- --output text)
124-
125- status_api_key=$(aws ssm get-parameter \
126- --name "/imms/apigee/non-prod/status-api-key" \
127- --with-decryption \
128- --query "Parameter.Value" \
129- --output text)
130-
131- export APIGEE_ACCESS_TOKEN=$apigee_token
132- 133- export APIGEE_ENVIRONMENT=int
134- export STATUS_API_KEY=$status_api_key
135- export PROXY_NAME=immunisation-fhir-api-internal-dev
136- export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4
137- export SSO_LOGIN_URL=https://login.apigee.com
156+ export APIGEE_ENVIRONMENT=internal-dev
157+ export PROXY_NAME=immunisation-fhir-api-int-${{ inputs.environment }}
158+ export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4-int-${{ inputs.environment }}
138159
139160 make run-immunization
0 commit comments