Skip to content

ci(eventarc): onboard pubsub sample to testing isolation #3988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 28, 2025
1 change: 1 addition & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"endpoints/getting-started-grpc",
"error-reporting",
"eventarc/generic",
"eventarc/pubsub",
"functions/concepts/afterResponse",
"functions/concepts/afterTimeout",
"functions/concepts/backgroundTermination",
Expand Down
1 change: 0 additions & 1 deletion .github/config/nodejs-prod.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"dlp", // [ERR_REQUIRE_ESM]: require() of ES Module
"document-ai", // [ERR_REQUIRE_ESM]: require() of ES Module
"eventarc/audit-storage", // (untested) Environment Variable 'SERVICE_NAME' not found
"eventarc/pubsub", // (untested) Environment Variable 'SERVICE_NAME' not found
"functions/billing", // Error: Request failed with status code 500
"functions/http/uploadFile", // npm error Missing script: "test"
"functions/imagemagick", // Error: A bucket name is needed to use Cloud Storage
Expand Down
6 changes: 6 additions & 0 deletions eventarc/pubsub/ci-setup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": {
"SERVICE_NAME": "eventarc-pubsub-${RUN_ID}",
"CONTAINER_IMAGE": "gcr.io/long-door-651/eventarc-pubsub:${RUN_ID}"
}
}
3 changes: 3 additions & 0 deletions eventarc/pubsub/test/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ requireEnv() {

requireEnv SERVICE_NAME
requireEnv CONTAINER_IMAGE
requireEnv SERVICE_ACCOUNT

# Build the service
set -x
Expand All @@ -35,6 +36,8 @@ gcloud run deploy "${SERVICE_NAME}" \
--region="${REGION:-us-central1}" \
${FLAGS} \
--platform=managed \
--service-account="${SERVICE_ACCOUNT}" \
--add-custom-audiences="https://action.test/" \
--quiet
set +x

Expand Down
6 changes: 3 additions & 3 deletions eventarc/pubsub/test/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ requireEnv() {
test "${!1}" || (echo "Environment Variable '$1' not found" && exit 1)
}
requireEnv SERVICE_NAME
requireEnv CONTAINER_IMAGE
requireEnv SERVICE_ACCOUNT
requireEnv ID_TOKEN

echo '---'
test/deploy.sh
Expand All @@ -33,14 +36,11 @@ echo
function cleanup {
set -x
gcloud run services delete ${SERVICE_NAME} \
--platform=managed \
--region="${REGION:-us-central1}" \
--quiet
}
trap cleanup EXIT

# TODO: Perform authentication inside the test.
export ID_TOKEN=$(gcloud auth print-identity-token)
export BASE_URL=$(test/url.sh)

test -z "$BASE_URL" && echo "BASE_URL value is empty" && exit 1
Expand Down
Loading