Skip to content

Commit 5a1e566

Browse files
glasntdavidcavazos
andauthored
ci(eventarc): onboard pubsub sample to testing isolation (#3988)
* ci(eventarc): onboard pubsub sample to testing isolation * add new envvar, add custom random suffix code (WIP) * try different random suffix generator * debug current account * use RUN_ID as randomization * cleanup test given new envvars * add audience * correct audience * remove unneeded params * exclude from dev --------- Co-authored-by: David Cavazos <[email protected]>
1 parent a36eb37 commit 5a1e566

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

.github/config/nodejs-dev.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"endpoints/getting-started-grpc",
112112
"error-reporting",
113113
"eventarc/generic",
114+
"eventarc/pubsub",
114115
"functions/concepts/afterResponse",
115116
"functions/concepts/afterTimeout",
116117
"functions/concepts/backgroundTermination",

.github/config/nodejs-prod.jsonc

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

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/deploy.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ requireEnv() {
2222

2323
requireEnv SERVICE_NAME
2424
requireEnv CONTAINER_IMAGE
25+
requireEnv SERVICE_ACCOUNT
2526

2627
# Build the service
2728
set -x
@@ -35,6 +36,8 @@ gcloud run deploy "${SERVICE_NAME}" \
3536
--region="${REGION:-us-central1}" \
3637
${FLAGS} \
3738
--platform=managed \
39+
--service-account="${SERVICE_ACCOUNT}" \
40+
--add-custom-audiences="https://action.test/" \
3841
--quiet
3942
set +x
4043

eventarc/pubsub/test/runner.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ requireEnv() {
2020
test "${!1}" || (echo "Environment Variable '$1' not found" && exit 1)
2121
}
2222
requireEnv SERVICE_NAME
23+
requireEnv CONTAINER_IMAGE
24+
requireEnv SERVICE_ACCOUNT
25+
requireEnv ID_TOKEN
2326

2427
echo '---'
2528
test/deploy.sh
@@ -33,14 +36,11 @@ echo
3336
function cleanup {
3437
set -x
3538
gcloud run services delete ${SERVICE_NAME} \
36-
--platform=managed \
3739
--region="${REGION:-us-central1}" \
3840
--quiet
3941
}
4042
trap cleanup EXIT
4143

42-
# TODO: Perform authentication inside the test.
43-
export ID_TOKEN=$(gcloud auth print-identity-token)
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)