Skip to content

Commit dad045b

Browse files
committed
wip: pass service account as env, to test
1 parent b21482e commit dad045b

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.github/workflows/ci-prod.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ jobs:
8585
path: ${{ fromJson(github.event_name == 'pull_request' && needs.affected.outputs.nodejs-paths || '[]') }}
8686
env:
8787
GOOGLE_SAMPLES_PROJECT: long-door-651
88+
GOOGLE_SERVICE_ACCOUNT: [email protected]
8889
CI_SETUP: ${{ toJson(fromJson(needs.affected.outputs.nodejs-setups)[matrix.path])}}
8990
steps:
9091
- name: CI Setup
@@ -99,7 +100,7 @@ jobs:
99100
with:
100101
project_id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
101102
workload_identity_provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
102-
service_account: [email protected]
103+
service_account: ${{ env.GOOGLE_SERVICE_ACCOUNT }}
103104
access_token_lifetime: 600s # 10 minutes
104105
- name: Export environment variables
105106
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7

run/idp-sql/test/e2e_test_cleanup.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ substitutions:
2020
_VERSION: manual
2121
_REGION: us-central1
2222
_PLATFORM: managed
23+
_SERVICE_ACCOUNT: ${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com
24+
25+
serviceAccount: 'projects/${PROJECT_ID}/serviceAccounts/${_SERVICE_ACCOUNT}'

run/idp-sql/test/e2e_test_setup.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ substitutions:
5757
_DB_NAME: postgres
5858
_DB_USER: postgres
5959
_DB_PASSWORD: password1234
60+
_SERVICE_ACCOUNT: ${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com
61+
62+
serviceAccount: 'projects/${PROJECT_ID}/serviceAccounts/${_SERVICE_ACCOUNT}'
63+

run/idp-sql/test/system.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ describe('System Tests', () => {
3232
console.log('"SERVICE_NAME" env var not found. Defaulting to "idp-sql"');
3333
SERVICE_NAME = 'idp-sql';
3434
}
35+
36+
const {GOOGLE_SERVICE_ACCOUNT} = process.env;
3537
const {SAMPLE_VERSION} = process.env;
3638
const PLATFORM = 'managed';
3739
const REGION = 'us-central1';
@@ -60,6 +62,7 @@ describe('System Tests', () => {
6062
'--config ./test/e2e_test_setup.yaml ' +
6163
`--substitutions _SERVICE=${SERVICE_NAME},_PLATFORM=${PLATFORM},_REGION=${REGION}` +
6264
`,_DB_PASSWORD=${DB_PASSWORD},_CLOUD_SQL_CONNECTION_NAME=${CLOUD_SQL_CONNECTION_NAME}`;
65+
if (GOOGLE_SERVICE_ACCOUNT) buildCmd += `,_SERVICE_ACCOUNT=${GOOGLE_SERVICE_ACCOUNT}`;
6366
if (SAMPLE_VERSION) buildCmd += `,_VERSION=${SAMPLE_VERSION}`;
6467

6568
console.log('Starting Cloud Build...');

0 commit comments

Comments
 (0)