Skip to content

Commit df1c718

Browse files
committed
Workflows - e2e dependencies
1 parent e64fd75 commit df1c718

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

.github/workflows/deploy-template.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
8484
e2e-tests:
8585
if: ${{ vars.RUN_E2E == 'true' && inputs.environment == vars.ACTIVE_ENVIRONMENT }}
86+
needs: terraform-plan
8687
runs-on: ubuntu-latest
8788
permissions:
8889
id-token: write
@@ -97,6 +98,16 @@ jobs:
9798
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/auto-ops
9899
role-session-name: github-actions
99100

101+
- uses: hashicorp/setup-terraform@v3
102+
with:
103+
terraform_version: "1.12.2"
104+
105+
- name: Terraform Init
106+
working-directory: ${{ vars.TERRAFORM_DIR_PATH }}
107+
run: |
108+
export BUCKET_NAME=${{ vars.TERRAFORM_STATE_BUCKET_NAME_INT }}
109+
make init environment=${{ inputs.environment }} aws_account_name=${{ inputs.aws_account_name }}
110+
100111
- name: Set up Python
101112
uses: actions/setup-python@v5
102113
with:
@@ -125,30 +136,29 @@ jobs:
125136
env:
126137
APIGEE_USERNAME: ${{ vars.APIGEE_USERNAME }}
127138
APIGEE_PASSWORD: ${{ secrets.APIGEE_PASSWORD }}
128-
MFA_CODE: ${{ env.MFA_CODE }}
129139
APIGEE_OAUTH_TOKEN: ${{ secrets.APIGEE_OAUTH_TOKEN }}
130-
OTP_SECRET: ${{ secrets.APIGEE_OTP_KEY }}
140+
APIGEE_OTP_SECRET: ${{ secrets.APIGEE_OTP_KEY }}
131141
run: |
132-
CODE=$(oathtool --totp -b "$OTP_SECRET")
133-
echo "::add-mask::$CODE"
142+
CODE=$(oathtool --totp -b "$APIGEE_OTP_SECRET")
143+
echo "::add-mask::$CODE"
134144
135-
echo "Requesting access token from Apigee..."
145+
echo "Requesting access token from Apigee..."
136146
137-
response=$(curl -s -X POST "https://login.apigee.com/oauth/token" \
138-
-H "Content-Type: application/x-www-form-urlencoded" \
139-
-H "Accept: application/json;charset=utf-8" \
140-
-H "Authorization: Basic $APIGEE_OAUTH_TOKEN" \
141-
-d "username=$APIGEE_USERNAME&password=$APIGEE_PASSWORD&mfa_token=$CODE&grant_type=password")
147+
response=$(curl -s -X POST "https://login.apigee.com/oauth/token" \
148+
-H "Content-Type: application/x-www-form-urlencoded" \
149+
-H "Accept: application/json;charset=utf-8" \
150+
-H "Authorization: Basic $APIGEE_OAUTH_TOKEN" \
151+
-d "username=$APIGEE_USERNAME&password=$APIGEE_PASSWORD&mfa_token=$CODE&grant_type=password")
142152
143-
token=$(echo "$response" | jq -r '.access_token // empty')
153+
token=$(echo "$response" | jq -r '.access_token // empty')
144154
145-
if [[ -z "$token" ]]; then
146-
echo "Failed to retrieve access token"
147-
exit 1
148-
fi
155+
if [[ -z "$token" ]]; then
156+
echo "Failed to retrieve access token"
157+
exit 1
158+
fi
149159
150-
echo "::add-mask::$token"
151-
echo "APIGEE_ACCESS_TOKEN=$token" >> $GITHUB_ENV
160+
echo "::add-mask::$token"
161+
echo "APIGEE_ACCESS_TOKEN=$token" >> $GITHUB_ENV
152162
153163
- name: Run e2e tests
154164
working-directory: ${{ vars.E2E_DIR_PATH }}

0 commit comments

Comments
 (0)