Skip to content

Commit 72d652a

Browse files
committed
debug: try exporting access token for use in tests
1 parent 5eaff3c commit 72d652a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.github/config/nodejs-prod.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"dlp", // [ERR_REQUIRE_ESM]: require() of ES Module
8484
"document-ai", // [ERR_REQUIRE_ESM]: require() of ES Module
8585
"eventarc/audit-storage", // (untested) Environment Variable 'SERVICE_NAME' not found
86-
"eventarc/pubsub", // (untested) Environment Variable 'SERVICE_NAME' not found
8786
"functions/billing", // Error: Request failed with status code 500
8887
"functions/http/uploadFile", // npm error Missing script: "test"
8988
"functions/imagemagick", // Error: A bucket name is needed to use Cloud Storage

.github/workflows/ci-dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ jobs:
8484
with:
8585
node-version: ${{ fromJson(env.CI_SETUP).node-version }}
8686
- uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2
87+
id: auth
8788
with:
8889
project_id: ${{ env.GOOGLE_SAMPLES_PROJECT }}
8990
workload_identity_provider: projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
9091
service_account: [email protected]
9192
access_token_lifetime: 600s # 10 minutes
93+
token_format: 'access_token'
9294
- name: Export environment variables
9395
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
9496
id: vars
@@ -97,6 +99,7 @@ jobs:
9799
const { default: setupVars } = await import('${{ github.workspace }}/.github/scripts/setup-vars.js')
98100
const projectId = '${{ env.GOOGLE_SAMPLES_PROJECT }}';
99101
const setup = JSON.parse(process.env.CI_SETUP);
102+
setup['ACCESS_TOKEN'] = '${{steps.auth.outputs.access_token}}';
100103
return await setupVars({projectId, core, setup})
101104
- uses: google-github-actions/get-secretmanager-secrets@e5bb06c2ca53b244f978d33348d18317a7f263ce # v2
102105
if: ${{ fromJson(steps.vars.outputs.result).secrets }}

eventarc/pubsub/ci-setup.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"env": {
3+
"SERVICE_NAME": "eventarc-pubsub-$RUN_ID",
4+
"CONTAINER_IMAGE": "gcr.io/long-door-651/eventarc-pubsub:${RUN_ID}"
5+
}
6+
}

eventarc/pubsub/test/runner.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ function cleanup {
3939
}
4040
trap cleanup EXIT
4141

42-
# TODO: Perform authentication inside the test.
43-
export ID_TOKEN=$(gcloud auth print-identity-token)
42+
43+
export ID_TOKEN=$ACCESS_TOKEN # DEBUG
4444
export BASE_URL=$(test/url.sh)
4545

4646
test -z "$BASE_URL" && echo "BASE_URL value is empty" && exit 1

0 commit comments

Comments
 (0)