Skip to content

Commit f261f71

Browse files
committed
update service account
1 parent 3e4b64d commit f261f71

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

run/idp-sql/test/e2e_test_setup.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ steps:
1515
--replication-policy="automatic" \
1616
--data-file=postgres-secrets.json"
1717
18+
./test/retry.sh "gcloud secrets add-iam-policy-binding ${_SERVICE}-secrets \
19+
--member=serviceAccount:${_SERVICE_ACCOUNT} \
20+
--role=roles/secretmanager.secretAccessor"
21+
1822
- id: 'Build Container Image'
1923
name: 'gcr.io/cloud-builders/docker'
2024
entrypoint: '/bin/bash'
@@ -57,3 +61,9 @@ substitutions:
5761
_DB_NAME: postgres
5862
_DB_USER: postgres
5963
_DB_PASSWORD: password1234
64+
_SERVICE_ACCOUNT: ${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com
65+
66+
serviceAccount: 'projects/${PROJECT_ID}/serviceAccounts/${_SERVICE_ACCOUNT}'
67+
options:
68+
logging: CLOUD_LOGGING_ONLY
69+
dynamicSubstitutions: true

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('System Tests', () => {
3333
SERVICE_NAME = 'idp-sql';
3434
}
3535
const {SAMPLE_VERSION} = process.env;
36+
const {SERVICE_ACCOUNT} = process.env;
3637
const PLATFORM = 'managed';
3738
const REGION = 'us-central1';
3839

@@ -61,6 +62,7 @@ describe('System Tests', () => {
6162
`--substitutions _SERVICE=${SERVICE_NAME},_PLATFORM=${PLATFORM},_REGION=${REGION}` +
6263
`,_DB_PASSWORD=${DB_PASSWORD},_CLOUD_SQL_CONNECTION_NAME=${CLOUD_SQL_CONNECTION_NAME}`;
6364
if (SAMPLE_VERSION) buildCmd += `,_VERSION=${SAMPLE_VERSION}`;
65+
if (SERVICE_ACCOUNT) buildCmd += `,_SERVICE_ACCOUNT=${SERVICE_ACCOUNT}`;
6466

6567
console.log('Starting Cloud Build...');
6668
execSync(buildCmd, {timeout: 240000, shell: true}); // timeout at 4 mins
@@ -110,6 +112,7 @@ describe('System Tests', () => {
110112
'--config ./test/e2e_test_cleanup.yaml ' +
111113
`--substitutions _SERVICE=${SERVICE_NAME},_PLATFORM=${PLATFORM},_REGION=${REGION}`;
112114
if (SAMPLE_VERSION) cleanUpCmd += `,_VERSION=${SAMPLE_VERSION}`;
115+
if (SERVICE_ACCOUNT) cleanUpCmd += `,_SERVICE_ACCOUNT=${SERVICE_ACCOUNT}`;
113116

114117
execSync(cleanUpCmd, {shell: true});
115118
});

0 commit comments

Comments
 (0)