From 6b0609b0cb2d8ee694816ce76261a0767ce935c0 Mon Sep 17 00:00:00 2001 From: Santi Quiroga Date: Thu, 19 Nov 2026 20:07:23 +0000 Subject: [PATCH] chore(core): remove legacy CI configs and empty test stubs --- core/common/.kokoro/common.cfg | 24 - .../.kokoro/continuous/node18/common.cfg | 24 - .../common/.kokoro/continuous/node18/lint.cfg | 4 - .../continuous/node18/samples-test.cfg | 12 - .../.kokoro/continuous/node18/system-test.cfg | 12 - .../common/.kokoro/continuous/node18/test.cfg | 0 core/common/.kokoro/docs.sh | 26 - core/common/.kokoro/lint.sh | 35 - core/common/.kokoro/populate-secrets.sh | 76 -- .../.kokoro/presubmit/node18/common.cfg | 24 - .../.kokoro/presubmit/node18/samples-test.cfg | 12 - .../.kokoro/presubmit/node18/system-test.cfg | 12 - core/common/.kokoro/presubmit/node18/test.cfg | 0 .../.kokoro/presubmit/windows/common.cfg | 2 - .../common/.kokoro/presubmit/windows/test.cfg | 2 - core/common/.kokoro/publish.sh | 43 - core/common/.kokoro/release/common.cfg | 8 - core/common/.kokoro/release/docs-devsite.cfg | 26 - core/common/.kokoro/release/docs-devsite.sh | 32 - core/common/.kokoro/release/docs.cfg | 26 - core/common/.kokoro/release/docs.sh | 50 - core/common/.kokoro/release/publish.cfg | 51 - core/common/.kokoro/samples-test.sh | 72 -- core/common/.kokoro/system-test.sh | 62 -- core/common/.kokoro/test.bat | 33 - core/common/.kokoro/test.sh | 52 - core/common/.kokoro/trampoline.sh | 32 - core/common/.kokoro/trampoline_v2.sh | 510 --------- core/common/.trampolinerc | 52 - core/common/package.json | 3 +- .../CODE_OF_CONDUCT.md | 94 -- .../CONTRIBUTING.md | 76 -- .../duplicate_methods_test-esm/LICENSE | 202 ---- .../duplicate_methods_test-esm/README.md | 108 -- .../esm/src/index.ts | 26 - .../esm/src/json-helper.cjs | 20 - .../duplicate_methods_test_service_client.ts | 917 ---------------- ...te_methods_test_service_client_config.json | 38 - ...icate_methods_test_service_proto_list.json | 3 - .../esm/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.cjs | 27 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 33 - .../esm/system-test/install.ts | 55 - ...gapic_duplicate_methods_test_service_v1.ts | 977 ------------------ .../duplicate_methods_test-esm/package.json | 103 -- .../v1/duplicate_methods_test_v1.proto | 66 -- .../v1/duplicate_methods_test_service.echo.js | 59 -- ...ate_methods_test_service.get_iam_policy.js | 67 -- ...ate_methods_test_service.list_locations.js | 74 -- ...data_google.duplicate_methods_test.v1.json | 151 --- .../tsconfig.esm.json | 27 - .../duplicate_methods_test-esm/tsconfig.json | 32 - .../webpack.config.cjs | 64 -- core/packages/gax/.trampolinerc | 52 - .../retry-request/.circleci/config.yml | 27 - core/paginator/.kokoro/common.cfg | 24 - .../.kokoro/continuous/node18/common.cfg | 24 - .../.kokoro/continuous/node18/lint.cfg | 4 - .../continuous/node18/samples-test.cfg | 12 - .../.kokoro/continuous/node18/system-test.cfg | 12 - .../.kokoro/continuous/node18/test.cfg | 0 core/paginator/.kokoro/docs.sh | 26 - core/paginator/.kokoro/lint.sh | 35 - core/paginator/.kokoro/populate-secrets.sh | 76 -- .../.kokoro/presubmit/node18/common.cfg | 24 - .../.kokoro/presubmit/node18/test.cfg | 0 .../.kokoro/presubmit/windows/common.cfg | 2 - .../.kokoro/presubmit/windows/test.cfg | 2 - core/paginator/.kokoro/publish.sh | 43 - core/paginator/.kokoro/release/common.cfg | 8 - .../.kokoro/release/docs-devsite.cfg | 26 - .../paginator/.kokoro/release/docs-devsite.sh | 32 - core/paginator/.kokoro/release/docs.cfg | 26 - core/paginator/.kokoro/release/docs.sh | 50 - core/paginator/.kokoro/release/publish.cfg | 51 - core/paginator/.kokoro/test.bat | 33 - core/paginator/.kokoro/test.sh | 52 - core/paginator/.kokoro/trampoline.sh | 32 - core/paginator/.kokoro/trampoline_v2.sh | 510 --------- core/paginator/.trampolinerc | 52 - core/precise-date/.kokoro/common.cfg | 24 - .../.kokoro/continuous/node18/common.cfg | 24 - .../.kokoro/continuous/node18/lint.cfg | 4 - .../continuous/node18/samples-test.cfg | 12 - .../.kokoro/continuous/node18/system-test.cfg | 12 - .../.kokoro/continuous/node18/test.cfg | 0 core/precise-date/.kokoro/docs.sh | 26 - core/precise-date/.kokoro/lint.sh | 35 - core/precise-date/.kokoro/populate-secrets.sh | 76 -- .../.kokoro/presubmit/node18/common.cfg | 24 - .../.kokoro/presubmit/node18/samples-test.cfg | 12 - .../.kokoro/presubmit/node18/system-test.cfg | 12 - .../.kokoro/presubmit/node18/test.cfg | 0 .../.kokoro/presubmit/windows/common.cfg | 2 - .../.kokoro/presubmit/windows/test.cfg | 2 - core/precise-date/.kokoro/publish.sh | 43 - core/precise-date/.kokoro/release/common.cfg | 8 - .../.kokoro/release/docs-devsite.cfg | 26 - .../.kokoro/release/docs-devsite.sh | 32 - core/precise-date/.kokoro/release/docs.cfg | 26 - core/precise-date/.kokoro/release/docs.sh | 50 - core/precise-date/.kokoro/release/publish.cfg | 51 - core/precise-date/.kokoro/samples-test.sh | 72 -- core/precise-date/.kokoro/system-test.sh | 62 -- core/precise-date/.kokoro/test.bat | 33 - core/precise-date/.kokoro/test.sh | 52 - core/precise-date/.kokoro/trampoline.sh | 32 - core/precise-date/.kokoro/trampoline_v2.sh | 510 --------- core/precise-date/.trampolinerc | 52 - core/precise-date/package.json | 6 +- core/precise-date/system-test/system.ts | 15 - core/precise-date/tsconfig.json | 3 +- core/projectify/.kokoro/common.cfg | 24 - .../.kokoro/continuous/node18/common.cfg | 24 - .../.kokoro/continuous/node18/lint.cfg | 4 - .../continuous/node18/samples-test.cfg | 12 - .../.kokoro/continuous/node18/system-test.cfg | 12 - .../.kokoro/continuous/node18/test.cfg | 0 core/projectify/.kokoro/docs.sh | 26 - core/projectify/.kokoro/lint.sh | 35 - core/projectify/.kokoro/populate-secrets.sh | 76 -- .../.kokoro/presubmit/node18/common.cfg | 24 - .../.kokoro/presubmit/node18/samples-test.cfg | 12 - .../.kokoro/presubmit/node18/test.cfg | 0 .../.kokoro/presubmit/windows/common.cfg | 2 - .../.kokoro/presubmit/windows/test.cfg | 2 - core/projectify/.kokoro/publish.sh | 43 - core/projectify/.kokoro/release/common.cfg | 8 - .../.kokoro/release/docs-devsite.cfg | 26 - .../.kokoro/release/docs-devsite.sh | 32 - core/projectify/.kokoro/release/docs.cfg | 26 - core/projectify/.kokoro/release/docs.sh | 50 - core/projectify/.kokoro/release/publish.cfg | 51 - core/projectify/.kokoro/samples-test.sh | 72 -- core/projectify/.kokoro/system-test.sh | 62 -- core/projectify/.kokoro/test.bat | 33 - core/projectify/.kokoro/test.sh | 52 - core/projectify/.kokoro/trampoline.sh | 32 - core/projectify/.kokoro/trampoline_v2.sh | 510 --------- core/projectify/.trampolinerc | 52 - core/promisify/.kokoro/common.cfg | 24 - .../.kokoro/continuous/node18/common.cfg | 24 - .../.kokoro/continuous/node18/lint.cfg | 4 - .../continuous/node18/samples-test.cfg | 12 - .../.kokoro/continuous/node18/system-test.cfg | 12 - .../.kokoro/continuous/node18/test.cfg | 0 core/promisify/.kokoro/docs.sh | 26 - core/promisify/.kokoro/lint.sh | 35 - core/promisify/.kokoro/populate-secrets.sh | 76 -- .../.kokoro/presubmit/node18/common.cfg | 24 - .../.kokoro/presubmit/node18/samples-test.cfg | 12 - .../.kokoro/presubmit/node18/system-test.cfg | 12 - .../.kokoro/presubmit/node18/test.cfg | 0 .../.kokoro/presubmit/windows/common.cfg | 2 - .../.kokoro/presubmit/windows/test.cfg | 2 - core/promisify/.kokoro/publish.sh | 43 - core/promisify/.kokoro/release/common.cfg | 8 - .../.kokoro/release/docs-devsite.cfg | 26 - .../promisify/.kokoro/release/docs-devsite.sh | 32 - core/promisify/.kokoro/release/docs.cfg | 26 - core/promisify/.kokoro/release/docs.sh | 50 - core/promisify/.kokoro/release/publish.cfg | 51 - core/promisify/.kokoro/samples-test.sh | 72 -- core/promisify/.kokoro/system-test.sh | 62 -- core/promisify/.kokoro/test.bat | 33 - core/promisify/.kokoro/test.sh | 52 - core/promisify/.kokoro/trampoline.sh | 32 - core/promisify/.kokoro/trampoline_v2.sh | 510 --------- core/promisify/.trampolinerc | 52 - core/promisify/package.json | 6 +- core/promisify/system-test/system.ts | 15 - core/promisify/tsconfig.json | 3 +- 173 files changed, 7 insertions(+), 9788 deletions(-) delete mode 100644 core/common/.kokoro/common.cfg delete mode 100644 core/common/.kokoro/continuous/node18/common.cfg delete mode 100644 core/common/.kokoro/continuous/node18/lint.cfg delete mode 100644 core/common/.kokoro/continuous/node18/samples-test.cfg delete mode 100644 core/common/.kokoro/continuous/node18/system-test.cfg delete mode 100644 core/common/.kokoro/continuous/node18/test.cfg delete mode 100755 core/common/.kokoro/docs.sh delete mode 100755 core/common/.kokoro/lint.sh delete mode 100755 core/common/.kokoro/populate-secrets.sh delete mode 100644 core/common/.kokoro/presubmit/node18/common.cfg delete mode 100644 core/common/.kokoro/presubmit/node18/samples-test.cfg delete mode 100644 core/common/.kokoro/presubmit/node18/system-test.cfg delete mode 100644 core/common/.kokoro/presubmit/node18/test.cfg delete mode 100644 core/common/.kokoro/presubmit/windows/common.cfg delete mode 100644 core/common/.kokoro/presubmit/windows/test.cfg delete mode 100755 core/common/.kokoro/publish.sh delete mode 100644 core/common/.kokoro/release/common.cfg delete mode 100644 core/common/.kokoro/release/docs-devsite.cfg delete mode 100755 core/common/.kokoro/release/docs-devsite.sh delete mode 100644 core/common/.kokoro/release/docs.cfg delete mode 100755 core/common/.kokoro/release/docs.sh delete mode 100644 core/common/.kokoro/release/publish.cfg delete mode 100755 core/common/.kokoro/samples-test.sh delete mode 100755 core/common/.kokoro/system-test.sh delete mode 100644 core/common/.kokoro/test.bat delete mode 100755 core/common/.kokoro/test.sh delete mode 100755 core/common/.kokoro/trampoline.sh delete mode 100755 core/common/.kokoro/trampoline_v2.sh delete mode 100644 core/common/.trampolinerc delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CODE_OF_CONDUCT.md delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CONTRIBUTING.md delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/LICENSE delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/README.md delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/index.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/json-helper.cjs delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/index.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/install.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/package.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.esm.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.json delete mode 100644 core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/webpack.config.cjs delete mode 100644 core/packages/gax/.trampolinerc delete mode 100644 core/packages/retry-request/.circleci/config.yml delete mode 100644 core/paginator/.kokoro/common.cfg delete mode 100644 core/paginator/.kokoro/continuous/node18/common.cfg delete mode 100644 core/paginator/.kokoro/continuous/node18/lint.cfg delete mode 100644 core/paginator/.kokoro/continuous/node18/samples-test.cfg delete mode 100644 core/paginator/.kokoro/continuous/node18/system-test.cfg delete mode 100644 core/paginator/.kokoro/continuous/node18/test.cfg delete mode 100755 core/paginator/.kokoro/docs.sh delete mode 100755 core/paginator/.kokoro/lint.sh delete mode 100755 core/paginator/.kokoro/populate-secrets.sh delete mode 100644 core/paginator/.kokoro/presubmit/node18/common.cfg delete mode 100644 core/paginator/.kokoro/presubmit/node18/test.cfg delete mode 100644 core/paginator/.kokoro/presubmit/windows/common.cfg delete mode 100644 core/paginator/.kokoro/presubmit/windows/test.cfg delete mode 100755 core/paginator/.kokoro/publish.sh delete mode 100644 core/paginator/.kokoro/release/common.cfg delete mode 100644 core/paginator/.kokoro/release/docs-devsite.cfg delete mode 100755 core/paginator/.kokoro/release/docs-devsite.sh delete mode 100644 core/paginator/.kokoro/release/docs.cfg delete mode 100755 core/paginator/.kokoro/release/docs.sh delete mode 100644 core/paginator/.kokoro/release/publish.cfg delete mode 100644 core/paginator/.kokoro/test.bat delete mode 100755 core/paginator/.kokoro/test.sh delete mode 100755 core/paginator/.kokoro/trampoline.sh delete mode 100755 core/paginator/.kokoro/trampoline_v2.sh delete mode 100644 core/paginator/.trampolinerc delete mode 100644 core/precise-date/.kokoro/common.cfg delete mode 100644 core/precise-date/.kokoro/continuous/node18/common.cfg delete mode 100644 core/precise-date/.kokoro/continuous/node18/lint.cfg delete mode 100644 core/precise-date/.kokoro/continuous/node18/samples-test.cfg delete mode 100644 core/precise-date/.kokoro/continuous/node18/system-test.cfg delete mode 100644 core/precise-date/.kokoro/continuous/node18/test.cfg delete mode 100755 core/precise-date/.kokoro/docs.sh delete mode 100755 core/precise-date/.kokoro/lint.sh delete mode 100755 core/precise-date/.kokoro/populate-secrets.sh delete mode 100644 core/precise-date/.kokoro/presubmit/node18/common.cfg delete mode 100644 core/precise-date/.kokoro/presubmit/node18/samples-test.cfg delete mode 100644 core/precise-date/.kokoro/presubmit/node18/system-test.cfg delete mode 100644 core/precise-date/.kokoro/presubmit/node18/test.cfg delete mode 100644 core/precise-date/.kokoro/presubmit/windows/common.cfg delete mode 100644 core/precise-date/.kokoro/presubmit/windows/test.cfg delete mode 100755 core/precise-date/.kokoro/publish.sh delete mode 100644 core/precise-date/.kokoro/release/common.cfg delete mode 100644 core/precise-date/.kokoro/release/docs-devsite.cfg delete mode 100755 core/precise-date/.kokoro/release/docs-devsite.sh delete mode 100644 core/precise-date/.kokoro/release/docs.cfg delete mode 100755 core/precise-date/.kokoro/release/docs.sh delete mode 100644 core/precise-date/.kokoro/release/publish.cfg delete mode 100755 core/precise-date/.kokoro/samples-test.sh delete mode 100755 core/precise-date/.kokoro/system-test.sh delete mode 100644 core/precise-date/.kokoro/test.bat delete mode 100755 core/precise-date/.kokoro/test.sh delete mode 100755 core/precise-date/.kokoro/trampoline.sh delete mode 100755 core/precise-date/.kokoro/trampoline_v2.sh delete mode 100644 core/precise-date/.trampolinerc delete mode 100644 core/precise-date/system-test/system.ts delete mode 100644 core/projectify/.kokoro/common.cfg delete mode 100644 core/projectify/.kokoro/continuous/node18/common.cfg delete mode 100644 core/projectify/.kokoro/continuous/node18/lint.cfg delete mode 100644 core/projectify/.kokoro/continuous/node18/samples-test.cfg delete mode 100644 core/projectify/.kokoro/continuous/node18/system-test.cfg delete mode 100644 core/projectify/.kokoro/continuous/node18/test.cfg delete mode 100755 core/projectify/.kokoro/docs.sh delete mode 100755 core/projectify/.kokoro/lint.sh delete mode 100755 core/projectify/.kokoro/populate-secrets.sh delete mode 100644 core/projectify/.kokoro/presubmit/node18/common.cfg delete mode 100644 core/projectify/.kokoro/presubmit/node18/samples-test.cfg delete mode 100644 core/projectify/.kokoro/presubmit/node18/test.cfg delete mode 100644 core/projectify/.kokoro/presubmit/windows/common.cfg delete mode 100644 core/projectify/.kokoro/presubmit/windows/test.cfg delete mode 100755 core/projectify/.kokoro/publish.sh delete mode 100644 core/projectify/.kokoro/release/common.cfg delete mode 100644 core/projectify/.kokoro/release/docs-devsite.cfg delete mode 100755 core/projectify/.kokoro/release/docs-devsite.sh delete mode 100644 core/projectify/.kokoro/release/docs.cfg delete mode 100755 core/projectify/.kokoro/release/docs.sh delete mode 100644 core/projectify/.kokoro/release/publish.cfg delete mode 100755 core/projectify/.kokoro/samples-test.sh delete mode 100755 core/projectify/.kokoro/system-test.sh delete mode 100644 core/projectify/.kokoro/test.bat delete mode 100755 core/projectify/.kokoro/test.sh delete mode 100755 core/projectify/.kokoro/trampoline.sh delete mode 100755 core/projectify/.kokoro/trampoline_v2.sh delete mode 100644 core/projectify/.trampolinerc delete mode 100644 core/promisify/.kokoro/common.cfg delete mode 100644 core/promisify/.kokoro/continuous/node18/common.cfg delete mode 100644 core/promisify/.kokoro/continuous/node18/lint.cfg delete mode 100644 core/promisify/.kokoro/continuous/node18/samples-test.cfg delete mode 100644 core/promisify/.kokoro/continuous/node18/system-test.cfg delete mode 100644 core/promisify/.kokoro/continuous/node18/test.cfg delete mode 100755 core/promisify/.kokoro/docs.sh delete mode 100755 core/promisify/.kokoro/lint.sh delete mode 100755 core/promisify/.kokoro/populate-secrets.sh delete mode 100644 core/promisify/.kokoro/presubmit/node18/common.cfg delete mode 100644 core/promisify/.kokoro/presubmit/node18/samples-test.cfg delete mode 100644 core/promisify/.kokoro/presubmit/node18/system-test.cfg delete mode 100644 core/promisify/.kokoro/presubmit/node18/test.cfg delete mode 100644 core/promisify/.kokoro/presubmit/windows/common.cfg delete mode 100644 core/promisify/.kokoro/presubmit/windows/test.cfg delete mode 100755 core/promisify/.kokoro/publish.sh delete mode 100644 core/promisify/.kokoro/release/common.cfg delete mode 100644 core/promisify/.kokoro/release/docs-devsite.cfg delete mode 100755 core/promisify/.kokoro/release/docs-devsite.sh delete mode 100644 core/promisify/.kokoro/release/docs.cfg delete mode 100755 core/promisify/.kokoro/release/docs.sh delete mode 100644 core/promisify/.kokoro/release/publish.cfg delete mode 100755 core/promisify/.kokoro/samples-test.sh delete mode 100755 core/promisify/.kokoro/system-test.sh delete mode 100644 core/promisify/.kokoro/test.bat delete mode 100755 core/promisify/.kokoro/test.sh delete mode 100755 core/promisify/.kokoro/trampoline.sh delete mode 100755 core/promisify/.kokoro/trampoline_v2.sh delete mode 100644 core/promisify/.trampolinerc delete mode 100644 core/promisify/system-test/system.ts diff --git a/core/common/.kokoro/common.cfg b/core/common/.kokoro/common.cfg deleted file mode 100644 index 03e725f9506c..000000000000 --- a/core/common/.kokoro/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/test.sh" -} diff --git a/core/common/.kokoro/continuous/node18/common.cfg b/core/common/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 03e725f9506c..000000000000 --- a/core/common/.kokoro/continuous/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/test.sh" -} diff --git a/core/common/.kokoro/continuous/node18/lint.cfg b/core/common/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index b283df899b5a..000000000000 --- a/core/common/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/lint.sh" -} diff --git a/core/common/.kokoro/continuous/node18/samples-test.cfg b/core/common/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index 32544a29da92..000000000000 --- a/core/common/.kokoro/continuous/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/common/.kokoro/continuous/node18/system-test.cfg b/core/common/.kokoro/continuous/node18/system-test.cfg deleted file mode 100644 index 49e467683542..000000000000 --- a/core/common/.kokoro/continuous/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/common/.kokoro/continuous/node18/test.cfg b/core/common/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/common/.kokoro/docs.sh b/core/common/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/core/common/.kokoro/docs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/core/common/.kokoro/lint.sh b/core/common/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/core/common/.kokoro/lint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -# Install and link samples -if [ -f samples/package.json ]; then - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. -fi - -pnpm run lint diff --git a/core/common/.kokoro/populate-secrets.sh b/core/common/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/core/common/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is called in the early stage of `trampoline_v2.sh` to -# populate secrets needed for the CI builds. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - -# Populates requested secrets set in SECRET_MANAGER_KEYS - -# In Kokoro CI builds, we use the service account attached to the -# Kokoro VM. This means we need to setup auth on other CI systems. -# For local run, we just use the gcloud command for retrieving the -# secrets. - -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - GCLOUD_COMMANDS=( - "docker" - "run" - "--entrypoint=gcloud" - "--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}" - "gcr.io/google.com/cloudsdktool/cloud-sdk" - ) - if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - else - echo "Authentication for this CI system is not implemented yet." - exit 2 - # TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS. - fi -else - # For local run, use /dev/shm or temporary directory for - # KOKORO_GFILE_DIR. - if [[ -d "/dev/shm" ]]; then - export KOKORO_GFILE_DIR=/dev/shm - else - export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX) - fi - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - GCLOUD_COMMANDS=("gcloud") -fi - -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} - -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - "${GCLOUD_COMMANDS[@]}" \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret $key > \ - "$SECRET_LOCATION/$key" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - exit 2 - fi -done diff --git a/core/common/.kokoro/presubmit/node18/common.cfg b/core/common/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 03e725f9506c..000000000000 --- a/core/common/.kokoro/presubmit/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/test.sh" -} diff --git a/core/common/.kokoro/presubmit/node18/samples-test.cfg b/core/common/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index 32544a29da92..000000000000 --- a/core/common/.kokoro/presubmit/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/common/.kokoro/presubmit/node18/system-test.cfg b/core/common/.kokoro/presubmit/node18/system-test.cfg deleted file mode 100644 index 49e467683542..000000000000 --- a/core/common/.kokoro/presubmit/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/common/.kokoro/presubmit/node18/test.cfg b/core/common/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/common/.kokoro/presubmit/windows/common.cfg b/core/common/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/core/common/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/core/common/.kokoro/presubmit/windows/test.cfg b/core/common/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index 456fc6248e3b..000000000000 --- a/core/common/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-common/core/common/.kokoro/test.bat" diff --git a/core/common/.kokoro/publish.sh b/core/common/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/core/common/.kokoro/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Start the releasetool reporter -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -cd $(dirname $0)/.. - -NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1) -echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc - -npm install -g pnpm@9 -pnpm install -npm pack . -# npm provides no way to specify, observe, or predict the name of the tarball -# file it generates. We have to look in the current directory for the freshest -# .tgz file. -TARBALL=$(ls -1 -t *.tgz | head -1) - -npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL" - -# Kokoro collects *.tgz and package-lock.json files and stores them in Placer -# so we can generate SBOMs and attestations. -# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files -# that happened to be installed with dependencies. -find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f \ No newline at end of file diff --git a/core/common/.kokoro/release/common.cfg b/core/common/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/core/common/.kokoro/release/common.cfg +++ /dev/null @@ -1,8 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} diff --git a/core/common/.kokoro/release/docs-devsite.cfg b/core/common/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index e5bf8a2d6012..000000000000 --- a/core/common/.kokoro/release/docs-devsite.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/release/docs-devsite.sh" -} diff --git a/core/common/.kokoro/release/docs-devsite.sh b/core/common/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/core/common/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi - -npm install -g pnpm@9 -pnpm install -npm install -g pnpm@9 -pnpm install --no-save @google-cloud/cloud-rad@^0.4.0 -# publish docs to devsite -npx @google-cloud/cloud-rad . cloud-rad diff --git a/core/common/.kokoro/release/docs.cfg b/core/common/.kokoro/release/docs.cfg deleted file mode 100644 index b3854edd2f61..000000000000 --- a/core/common/.kokoro/release/docs.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/release/docs.sh" -} diff --git a/core/common/.kokoro/release/docs.sh b/core/common/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/core/common/.kokoro/release/docs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# build jsdocs (Python is installed on the Node 18 docker image). -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi -npm install -g pnpm@9 -pnpm install -pnpm run docs - -# create docs.metadata, based on package.json and .repo-metadata.json. -npm i json@9.0.6 -g -python3 -m docuploader create-metadata \ - --name=$(cat .repo-metadata.json | json name) \ - --version=$(cat package.json | json version) \ - --language=$(cat .repo-metadata.json | json language) \ - --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ - --product-page=$(cat .repo-metadata.json | json product_documentation) \ - --github-repository=$(cat .repo-metadata.json | json repo) \ - --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) -cp docs.metadata ./docs/docs.metadata - -# deploy the docs. -if [[ -z "$CREDENTIALS" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi -if [[ -z "$BUCKET" ]]; then - BUCKET=docs-staging -fi -python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/core/common/.kokoro/release/publish.cfg b/core/common/.kokoro/release/publish.cfg deleted file mode 100644 index 9d59ccfe7d17..000000000000 --- a/core/common/.kokoro/release/publish.cfg +++ /dev/null @@ -1,51 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-common/core/common/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-common/core/common/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.org and their corresponding -# package-lock.jsons in Placer. That way, we have a record of exactly -# what we published, and which version of which tools we used to publish -# it, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/**/*.tgz" - regex: "github/**/package-lock.json" - strip_prefix: "github" - } -} diff --git a/core/common/.kokoro/samples-test.sh b/core/common/.kokoro/samples-test.sh deleted file mode 100755 index 16b4a5e95b2a..000000000000 --- a/core/common/.kokoro/samples-test.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p $NPM_CONFIG_PREFIX -npm config -g ls || npm i -g npm@`npm --version` - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-samples-test.sh is in the project -if [ -f .kokoro/pre-samples-test.sh ]; then - set +x - . .kokoro/pre-samples-test.sh - set -x -fi - -if [ -f samples/package.json ]; then - npm install -g pnpm@9 - pnpm install - - # Install and link samples - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. - # If tests are running against main branch, configure flakybot - # to open issues on failures: - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP - fi - - pnpm run samples-test -fi - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/common/.kokoro/system-test.sh b/core/common/.kokoro/system-test.sh deleted file mode 100755 index 8373c5149ee6..000000000000 --- a/core/common/.kokoro/system-test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-system-test.sh is in the project -if [ -f .kokoro/pre-system-test.sh ]; then - set +x - . .kokoro/pre-system-test.sh - set -x -fi - -npm install -g pnpm@9 -pnpm install - -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi - -pnpm run system-test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/common/.kokoro/test.bat b/core/common/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/core/common/.kokoro/test.bat +++ /dev/null @@ -1,33 +0,0 @@ -@rem Copyright 2018 Google LLC. All rights reserved. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@echo "Starting Windows build" - -cd /d %~dp0 -cd .. - -@rem npm path is not currently set in our image, we should fix this next time -@rem we upgrade Node.js in the image: -SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm - -call nvm use 18 -call which node - -call npm install || goto :error -call npm run test || goto :error - -goto :EOF - -:error -exit /b 1 diff --git a/core/common/.kokoro/test.sh b/core/common/.kokoro/test.sh deleted file mode 100755 index ce54eddd8e2d..000000000000 --- a/core/common/.kokoro/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi -# Unit tests exercise the entire API surface, which may include -# deprecation warnings: -export MOCHA_THROW_DEPRECATION=false -pnpm test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/common/.kokoro/trampoline.sh b/core/common/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/core/common/.kokoro/trampoline.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is not used any more, but we keep this file for making it -# easy to roll back. -# TODO: Remove this file from the template. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/core/common/.kokoro/trampoline_v2.sh b/core/common/.kokoro/trampoline_v2.sh deleted file mode 100755 index a489702c20c7..000000000000 --- a/core/common/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# trampoline_v2.sh -# -# If you want to make a change to this file, consider doing so at: -# https://github.com/googlecloudplatform/docker-ci-helper -# -# This script is for running CI builds. For Kokoro builds, we -# set this script to `build_file` field in the Kokoro configuration. - -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. -# -# Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:18-user \ -# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ -# .kokoro/trampoline_v2.sh - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.7" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" - # Contains path to build artifacts being executed. - "KOKORO_BUILD_ARTIFACTS_SUBDIR" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For flakybot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")/core/common" -else - PROJECT_ROOT="$(repo_root $(pwd))/core/common" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# Auto-injected conditional check -# Check if the package directory has changes. If not, skip tests. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # The package path is hardcoded during migration - RELATIVE_PKG_PATH="core/common" - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - # Safe default: HEAD~1..HEAD - DIFF_RANGE="HEAD~1..HEAD" - - if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then - echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." - exit 0 - else - echo "Changes detected in ${RELATIVE_PKG_PATH}. Proceeding with tests." - fi -fi - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/core/common/.trampolinerc b/core/common/.trampolinerc deleted file mode 100644 index a03c8d1af836..000000000000 --- a/core/common/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/core/common/.kokoro/populate-secrets.sh diff --git a/core/common/package.json b/core/common/package.json index bd5e938f80b3..beab64fa2654 100644 --- a/core/common/package.json +++ b/core/common/package.json @@ -28,8 +28,7 @@ "lint": "gts check", "presystem-test": "npm run compile", "system-test": "mocha build/system-test", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "prelint": "cd samples; npm link ../; npm install", + "samples-test": "echo 'no samples tests'", "clean": "gts clean", "precompile": "gts clean" }, diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CODE_OF_CONDUCT.md b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CODE_OF_CONDUCT.md deleted file mode 100644 index 2add2547a812..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,94 +0,0 @@ - -# Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of -experience, education, socio-economic status, nationality, personal appearance, -race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, or to ban temporarily or permanently any -contributor for other behaviors that they deem inappropriate, threatening, -offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -This Code of Conduct also applies outside the project spaces when the Project -Steward has a reasonable belief that an individual's behavior may have a -negative impact on the project or its community. - -## Conflict Resolution - -We do not believe that all conflict is bad; healthy debate and disagreement -often yield positive results. However, it is never okay to be disrespectful or -to engage in behavior that violates the project’s code of conduct. - -If you see someone violating the code of conduct, you are encouraged to address -the behavior directly with those involved. Many issues can be resolved quickly -and easily, and this gives people more control over the outcome of their -dispute. If you are unable to resolve the matter for any reason, or if the -behavior is threatening or harassing, report it. We are dedicated to providing -an environment where participants feel welcome and safe. - -Reports should be directed to *googleapis-stewards@google.com*, the -Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to -receive and address reported violations of the code of conduct. They will then -work with a committee consisting of representatives from the Open Source -Programs Office and the Google Open Source Strategy team. If for any reason you -are uncomfortable reaching out to the Project Steward, please email -opensource@google.com. - -We will investigate every complaint, but you may not receive a direct response. -We will use our discretion in determining when and how to follow up on reported -incidents, which may range from not taking action to permanent expulsion from -the project and project-sponsored spaces. We will notify the accused of the -report and provide them an opportunity to discuss it before any action is taken. -The identity of the reporter will be omitted from the details of the report -supplied to the accused. In potentially harmful situations, such as ongoing -harassment or threats to anyone's safety, we may take action without notice. - -## Attribution - -This Code of Conduct is adapted from the Contributor Covenant, version 1.4, -available at -https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CONTRIBUTING.md b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CONTRIBUTING.md deleted file mode 100644 index 8eb372e13d41..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/CONTRIBUTING.md +++ /dev/null @@ -1,76 +0,0 @@ -# How to become a contributor and submit your own code - -**Table of contents** - -* [Contributor License Agreements](#contributor-license-agreements) -* [Contributing a patch](#contributing-a-patch) -* [Running the tests](#running-the-tests) -* [Releasing the library](#releasing-the-library) - -## Contributor License Agreements - -We'd love to accept your sample apps and patches! Before we can take them, we -have to jump a couple of legal hurdles. - -Please fill out either the individual or corporate Contributor License Agreement -(CLA). - - * If you are an individual writing original source code and you're sure you - own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). - * If you work for a company that wants to allow you to contribute your work, - then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). - -Follow either of the two links above to access the appropriate CLA and -instructions for how to sign and return it. Once we receive it, we'll be able to -accept your pull requests. - -## Contributing A Patch - -1. Submit an issue describing your proposed change to the repo in question. -1. The repo owner will respond to your issue promptly. -1. If your proposed change is accepted, and you haven't already done so, sign a - Contributor License Agreement (see details above). -1. Fork the desired repo, develop and test your code changes. -1. Ensure that your code adheres to the existing style in the code to which - you are contributing. -1. Ensure that your code has an appropriate set of tests which all pass. -1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. -1. Submit a pull request. - -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Duplicate_methods_test API][enable_api]. -1. [Set up authentication with a service account][auth] so you can access the - API from your local workstation. - - -## Running the tests - -1. [Prepare your environment for Node.js setup][setup]. - -1. Install dependencies: - - pnpm install - -1. Run the tests: - - # Run unit tests. - pnpm run test - - # Run sample integration tests. - pnpm run samples-test - - # Run all system tests. - pnpm run system-test - -1. Lint (and maybe fix) any changes: - - pnpm run fix - -[setup]: https://cloud.google.com/nodejs/docs/setup -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=duplicatemethodstest.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/LICENSE b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/LICENSE deleted file mode 100644 index d64569567334..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/README.md b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/README.md deleted file mode 100644 index 2ad47e789f28..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/README.md +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Duplicate Methods Test Service API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/duplicate_methods_test-esm.svg)](https://www.npmjs.org/package/@google-cloud/duplicate_methods_test-esm) - -Duplicate Methods Test Service API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Duplicate Methods Test Service API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/duplicate_methods_test/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Duplicate Methods Test Service API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/duplicate_methods_test-esm -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/duplicate_methods_test-esm@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=duplicatemethodstest.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/index.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/index.ts deleted file mode 100644 index 2f77a6060187..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1/index.js'; -const DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -type DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -export {v1, DuplicateMethodsTestServiceClient}; -export default {v1, DuplicateMethodsTestServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/json-helper.cjs b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/json-helper.cjs deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/json-helper.cjs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts deleted file mode 100644 index 49a70fe1fe3b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts +++ /dev/null @@ -1,917 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as duplicate_methods_test_service_client_config from './duplicate_methods_test_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/duplicate_methods_test_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'duplicate_methods_test_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * @class - * @memberof v1 - */ -export class DuplicateMethodsTestServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('duplicate_methods_test-esm'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - duplicateMethodsTestServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DuplicateMethodsTestServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DuplicateMethodsTestServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DuplicateMethodsTestServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'duplicatemethodstest.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos as gax.protobuf.INamespace); - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listLocations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'locations') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.duplicate_methods_test.v1.DuplicateMethodsTestService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.duplicateMethodsTestServiceStub) { - return this.duplicateMethodsTestServiceStub; - } - - // Put together the "service stub" for - // google.duplicate_methods_test.v1.DuplicateMethodsTestService. - this.duplicateMethodsTestServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.duplicate_methods_test.v1.DuplicateMethodsTestService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.duplicate_methods_test.v1.DuplicateMethodsTestService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const duplicateMethodsTestServiceStubMethods = - ['getIamPolicy', 'listLocations', 'echo']; - for (const methodName of duplicateMethodsTestServiceStubMethods) { - const callPromise = this.duplicateMethodsTestServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.duplicateMethodsTestServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getIamPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('getIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Another native method to ensure the service is valid and has other methods. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.duplicate_methods_test.v1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.echo.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async - */ - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Native ListLocations method that conflicts with the Locations mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.location.Location|Location}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLocationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>, - callback?: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLocations values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listLocations request %j', request); - return this.innerApiCalls - .listLocations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]) => { - this._log.info('listLocations values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLocations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.location.Location|Location} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLocationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listLocationsStream( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations stream %j', request); - return this.descriptors.page.listLocations.createStream( - this.innerApiCalls.listLocations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLocations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.location.Location|Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.list_locations.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async - */ - listLocationsAsync( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations iterate %j', request); - return this.descriptors.page.listLocations.asyncIterate( - this.innerApiCalls['listLocations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - /** - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - /** - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.duplicateMethodsTestServiceStub && !this._terminated) { - return this.duplicateMethodsTestServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json deleted file mode 100644 index be7baac93862..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.duplicate_methods_test.v1.DuplicateMethodsTestService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLocations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json deleted file mode 100644 index d3ee7abc5dbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/index.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/index.ts deleted file mode 100644 index 0104bde3222f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DuplicateMethodsTestServiceClient} from './duplicate_methods_test_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs deleted file mode 100644 index dc8c439b40a0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const duplicate-methods-test = require('@google-cloud/duplicate_methods_test-esm'); - -function main() { - const duplicateMethodsTestServiceClient = new duplicate-methods-test.DuplicateMethodsTestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 26d8bef5a413..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as duplicate-methods-test from '@google-cloud/duplicate_methods_test-esm'; - -function main() { - const duplicateMethodsTestServiceClient = new duplicate-methods-test.DuplicateMethodsTestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index cf215c8b06cf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DuplicateMethodsTestServiceClient} from '@google-cloud/duplicate_methods_test-esm'; - -// check that the client class type name can be used -function doStuffWithDuplicateMethodsTestServiceClient(client: DuplicateMethodsTestServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const duplicateMethodsTestServiceClient = new DuplicateMethodsTestServiceClient(); - doStuffWithDuplicateMethodsTestServiceClient(duplicateMethodsTestServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/install.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/install.ts deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/system-test/install.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts deleted file mode 100644 index ad48c9cffc7b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts +++ /dev/null @@ -1,977 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as duplicatemethodstestserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DuplicateMethodsTestServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.servicePath; - assert.strictEqual(servicePath, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - await client.initialize(); - assert(client.duplicateMethodsTestServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.duplicateMethodsTestServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.duplicate_methods_test.v1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - }); - - it('invokes echo with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('listLocations', () => { - it('invokes listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCall(expectedResponse); - const [response] = await client.listLocations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLocations( - request, - (err?: Error|null, result?: protos.google.cloud.location.ILocation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLocations(request), expectedError); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocationsStream without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLocationsStream with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/package.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/package.json deleted file mode 100644 index 601325fad4ae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/package.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "name": "@google-cloud/duplicate_methods_test-esm", - "version": "0.1.0", - "description": "Duplicate_methods_test client for Node.js", - "repository": "googleapis/nodejs-duplicate-methods-test", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google duplicateMethodsTest", - "duplicateMethodsTest", - "duplicate methods test service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.json", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^6.0.0" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^17.0.4", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^2.0.0", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^5.0.0", - "jsdoc-fresh": "^6.0.0", - "long": "^5.3.2", - "mocha": "^11.7.4", - "pack-n-play": "^5.0.0", - "typescript": "5.8.3", - "sinon": "^21.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=22" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto deleted file mode 100644 index b91e79094ffa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.duplicate_methods_test.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/cloud/location/locations.proto"; - -option csharp_namespace = "Google.DuplicateMethodsTest.V1"; -option go_package = "google.golang.org/genproto/googleapis/duplicate_methods_test/v1;duplicate_methods_test"; -option java_multiple_files = true; -option java_outer_classname = "DuplicateMethodsTestProto"; -option java_package = "com.google.duplicate_methods_test.v1"; -option php_namespace = "Google\\DuplicateMethodsTest\\V1"; -option ruby_package = "Google::DuplicateMethodsTest::V1"; - -service DuplicateMethodsTestService { - option (google.api.default_host) = "duplicatemethodstest.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*}:getIamPolicy" - }; - } - - // Native ListLocations method that conflicts with the Locations mixin. - rpc ListLocations(google.cloud.location.ListLocationsRequest) returns (google.cloud.location.ListLocationsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*}/locations" - }; - } - - // Another native method to ensure the service is valid and has other methods. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1/echo" - body: "*" - }; - } -} - -message EchoRequest { - string content = 1; -} - -message EchoResponse { - string content = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js deleted file mode 100644 index 64b901b97c45..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const content = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('@google-cloud/duplicate_methods_test-esm').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callEcho() { - // Construct request - const request = { - }; - - // Run request - const response = await duplicateMethodsTestClient.echo(request); - console.log(response); - } - - callEcho(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js deleted file mode 100644 index caa51373b499..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('@google-cloud/duplicate_methods_test-esm').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await duplicateMethodsTestClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js deleted file mode 100644 index a6e028742d6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource that owns the locations collection, if applicable. - */ - // const name = 'abc123' - /** - * The standard list filter. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('@google-cloud/duplicate_methods_test-esm').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callListLocations() { - // Construct request - const request = { - }; - - // Run request - const iterable = duplicateMethodsTestClient.listLocationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLocations(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json deleted file mode 100644 index 5e881b6e29b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-duplicate-methods-test", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.duplicate_methods_test.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async", - "title": "DuplicateMethodsTestService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Native GetIamPolicy method that conflicts with the IAMPolicy mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async", - "title": "DuplicateMethodsTestService listLocations Sample", - "origin": "API_DEFINITION", - "description": " Native ListLocations method that conflicts with the Locations mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.list_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.location.ListLocationsResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async", - "title": "DuplicateMethodsTestService echo Sample", - "origin": "API_DEFINITION", - "description": " Another native method to ensure the service is valid and has other methods.", - "canonical": true, - "file": "duplicate_methods_test_service.echo.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.duplicate_methods_test.v1.EchoResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.esm.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.esm.json deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.esm.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.json b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.json deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/webpack.config.cjs b/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/webpack.config.cjs deleted file mode 100644 index 59e373662ce8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines-esm/duplicate_methods_test-esm/webpack.config.cjs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DuplicateMethodsTestService', - filename: './duplicate-methods-test-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/packages/gax/.trampolinerc b/core/packages/gax/.trampolinerc deleted file mode 100644 index 5fc2253137db..000000000000 --- a/core/packages/gax/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/.kokoro/populate-secrets.sh diff --git a/core/packages/retry-request/.circleci/config.yml b/core/packages/retry-request/.circleci/config.yml deleted file mode 100644 index c4e57a26b8c0..000000000000 --- a/core/packages/retry-request/.circleci/config.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: 2.1 - -install_and_test: &install_and_test - steps: - - checkout - - run: - name: Install - command: npm install - - run: - name: Test - command: npm test - -jobs: - test_node10: - docker: - - image: circleci/node:10 - <<: *install_and_test - test_node12: - docker: - - image: circleci/node:12 - <<: *install_and_test - -workflows: - test: - jobs: - - test_node10 - - test_node12 diff --git a/core/paginator/.kokoro/common.cfg b/core/paginator/.kokoro/common.cfg deleted file mode 100644 index e2adb241fd3e..000000000000 --- a/core/paginator/.kokoro/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/test.sh" -} diff --git a/core/paginator/.kokoro/continuous/node18/common.cfg b/core/paginator/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index e2adb241fd3e..000000000000 --- a/core/paginator/.kokoro/continuous/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/test.sh" -} diff --git a/core/paginator/.kokoro/continuous/node18/lint.cfg b/core/paginator/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index 84a0ec4715fc..000000000000 --- a/core/paginator/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/lint.sh" -} diff --git a/core/paginator/.kokoro/continuous/node18/samples-test.cfg b/core/paginator/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index 77cb50e1cd2f..000000000000 --- a/core/paginator/.kokoro/continuous/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/paginator/.kokoro/continuous/node18/system-test.cfg b/core/paginator/.kokoro/continuous/node18/system-test.cfg deleted file mode 100644 index 4175c5b4d5c7..000000000000 --- a/core/paginator/.kokoro/continuous/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/paginator/.kokoro/continuous/node18/test.cfg b/core/paginator/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/paginator/.kokoro/docs.sh b/core/paginator/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/core/paginator/.kokoro/docs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/core/paginator/.kokoro/lint.sh b/core/paginator/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/core/paginator/.kokoro/lint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -# Install and link samples -if [ -f samples/package.json ]; then - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. -fi - -pnpm run lint diff --git a/core/paginator/.kokoro/populate-secrets.sh b/core/paginator/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/core/paginator/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is called in the early stage of `trampoline_v2.sh` to -# populate secrets needed for the CI builds. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - -# Populates requested secrets set in SECRET_MANAGER_KEYS - -# In Kokoro CI builds, we use the service account attached to the -# Kokoro VM. This means we need to setup auth on other CI systems. -# For local run, we just use the gcloud command for retrieving the -# secrets. - -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - GCLOUD_COMMANDS=( - "docker" - "run" - "--entrypoint=gcloud" - "--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}" - "gcr.io/google.com/cloudsdktool/cloud-sdk" - ) - if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - else - echo "Authentication for this CI system is not implemented yet." - exit 2 - # TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS. - fi -else - # For local run, use /dev/shm or temporary directory for - # KOKORO_GFILE_DIR. - if [[ -d "/dev/shm" ]]; then - export KOKORO_GFILE_DIR=/dev/shm - else - export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX) - fi - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - GCLOUD_COMMANDS=("gcloud") -fi - -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} - -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - "${GCLOUD_COMMANDS[@]}" \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret $key > \ - "$SECRET_LOCATION/$key" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - exit 2 - fi -done diff --git a/core/paginator/.kokoro/presubmit/node18/common.cfg b/core/paginator/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index e2adb241fd3e..000000000000 --- a/core/paginator/.kokoro/presubmit/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/test.sh" -} diff --git a/core/paginator/.kokoro/presubmit/node18/test.cfg b/core/paginator/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/paginator/.kokoro/presubmit/windows/common.cfg b/core/paginator/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/core/paginator/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/core/paginator/.kokoro/presubmit/windows/test.cfg b/core/paginator/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index cb9baa82b399..000000000000 --- a/core/paginator/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-paginator/core/paginator/.kokoro/test.bat" diff --git a/core/paginator/.kokoro/publish.sh b/core/paginator/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/core/paginator/.kokoro/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Start the releasetool reporter -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -cd $(dirname $0)/.. - -NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1) -echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc - -npm install -g pnpm@9 -pnpm install -npm pack . -# npm provides no way to specify, observe, or predict the name of the tarball -# file it generates. We have to look in the current directory for the freshest -# .tgz file. -TARBALL=$(ls -1 -t *.tgz | head -1) - -npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL" - -# Kokoro collects *.tgz and package-lock.json files and stores them in Placer -# so we can generate SBOMs and attestations. -# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files -# that happened to be installed with dependencies. -find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f \ No newline at end of file diff --git a/core/paginator/.kokoro/release/common.cfg b/core/paginator/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/core/paginator/.kokoro/release/common.cfg +++ /dev/null @@ -1,8 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} diff --git a/core/paginator/.kokoro/release/docs-devsite.cfg b/core/paginator/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 65632bc08331..000000000000 --- a/core/paginator/.kokoro/release/docs-devsite.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/release/docs-devsite.sh" -} diff --git a/core/paginator/.kokoro/release/docs-devsite.sh b/core/paginator/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/core/paginator/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi - -npm install -g pnpm@9 -pnpm install -npm install -g pnpm@9 -pnpm install --no-save @google-cloud/cloud-rad@^0.4.0 -# publish docs to devsite -npx @google-cloud/cloud-rad . cloud-rad diff --git a/core/paginator/.kokoro/release/docs.cfg b/core/paginator/.kokoro/release/docs.cfg deleted file mode 100644 index c0ff0ca6dc81..000000000000 --- a/core/paginator/.kokoro/release/docs.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/release/docs.sh" -} diff --git a/core/paginator/.kokoro/release/docs.sh b/core/paginator/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/core/paginator/.kokoro/release/docs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# build jsdocs (Python is installed on the Node 18 docker image). -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi -npm install -g pnpm@9 -pnpm install -pnpm run docs - -# create docs.metadata, based on package.json and .repo-metadata.json. -npm i json@9.0.6 -g -python3 -m docuploader create-metadata \ - --name=$(cat .repo-metadata.json | json name) \ - --version=$(cat package.json | json version) \ - --language=$(cat .repo-metadata.json | json language) \ - --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ - --product-page=$(cat .repo-metadata.json | json product_documentation) \ - --github-repository=$(cat .repo-metadata.json | json repo) \ - --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) -cp docs.metadata ./docs/docs.metadata - -# deploy the docs. -if [[ -z "$CREDENTIALS" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi -if [[ -z "$BUCKET" ]]; then - BUCKET=docs-staging -fi -python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/core/paginator/.kokoro/release/publish.cfg b/core/paginator/.kokoro/release/publish.cfg deleted file mode 100644 index 8228cbcc9148..000000000000 --- a/core/paginator/.kokoro/release/publish.cfg +++ /dev/null @@ -1,51 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-paginator/core/paginator/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-paginator/core/paginator/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.org and their corresponding -# package-lock.jsons in Placer. That way, we have a record of exactly -# what we published, and which version of which tools we used to publish -# it, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/**/*.tgz" - regex: "github/**/package-lock.json" - strip_prefix: "github" - } -} diff --git a/core/paginator/.kokoro/test.bat b/core/paginator/.kokoro/test.bat deleted file mode 100644 index 0bb12405231d..000000000000 --- a/core/paginator/.kokoro/test.bat +++ /dev/null @@ -1,33 +0,0 @@ -@rem Copyright 2018 Google LLC. All rights reserved. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@echo "Starting Windows build" - -cd /d %~dp0 -cd .. - -@rem npm path is not currently set in our image, we should fix this next time -@rem we upgrade Node.js in the image: -SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm - -call nvm use v14.17.3 -call which node - -call npm install || goto :error -call npm run test || goto :error - -goto :EOF - -:error -exit /b 1 diff --git a/core/paginator/.kokoro/test.sh b/core/paginator/.kokoro/test.sh deleted file mode 100755 index dbdedcb310de..000000000000 --- a/core/paginator/.kokoro/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi -# Unit tests exercise the entire API surface, which may include -# deprecation warnings: -export MOCHA_THROW_DEPRECATION=false -pnpm test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/paginator/.kokoro/trampoline.sh b/core/paginator/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/core/paginator/.kokoro/trampoline.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is not used any more, but we keep this file for making it -# easy to roll back. -# TODO: Remove this file from the template. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/core/paginator/.kokoro/trampoline_v2.sh b/core/paginator/.kokoro/trampoline_v2.sh deleted file mode 100755 index 1fdd89c90802..000000000000 --- a/core/paginator/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# trampoline_v2.sh -# -# If you want to make a change to this file, consider doing so at: -# https://github.com/googlecloudplatform/docker-ci-helper -# -# This script is for running CI builds. For Kokoro builds, we -# set this script to `build_file` field in the Kokoro configuration. - -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. -# -# Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ -# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ -# .kokoro/trampoline_v2.sh - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.7" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" - # Contains path to build artifacts being executed. - "KOKORO_BUILD_ARTIFACTS_SUBDIR" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For flakybot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")/core/paginator" -else - PROJECT_ROOT="$(repo_root $(pwd))/core/paginator" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# Auto-injected conditional check -# Check if the package directory has changes. If not, skip tests. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # The package path is hardcoded during migration - RELATIVE_PKG_PATH="core/paginator" - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - # Safe default: HEAD~1..HEAD - DIFF_RANGE="HEAD~1..HEAD" - - if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then - echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." - exit 0 - else - echo "Changes detected in ${RELATIVE_PKG_PATH}. Proceeding with tests." - fi -fi - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/core/paginator/.trampolinerc b/core/paginator/.trampolinerc deleted file mode 100644 index 9b4f78ac8be5..000000000000 --- a/core/paginator/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/core/paginator/.kokoro/populate-secrets.sh diff --git a/core/precise-date/.kokoro/common.cfg b/core/precise-date/.kokoro/common.cfg deleted file mode 100644 index 3227c5c080ae..000000000000 --- a/core/precise-date/.kokoro/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/test.sh" -} diff --git a/core/precise-date/.kokoro/continuous/node18/common.cfg b/core/precise-date/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 3227c5c080ae..000000000000 --- a/core/precise-date/.kokoro/continuous/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/test.sh" -} diff --git a/core/precise-date/.kokoro/continuous/node18/lint.cfg b/core/precise-date/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index d045da1e7d4f..000000000000 --- a/core/precise-date/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/lint.sh" -} diff --git a/core/precise-date/.kokoro/continuous/node18/samples-test.cfg b/core/precise-date/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index dbb53caa8dea..000000000000 --- a/core/precise-date/.kokoro/continuous/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/precise-date/.kokoro/continuous/node18/system-test.cfg b/core/precise-date/.kokoro/continuous/node18/system-test.cfg deleted file mode 100644 index a5f00714e93c..000000000000 --- a/core/precise-date/.kokoro/continuous/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/precise-date/.kokoro/continuous/node18/test.cfg b/core/precise-date/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/precise-date/.kokoro/docs.sh b/core/precise-date/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/core/precise-date/.kokoro/docs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/core/precise-date/.kokoro/lint.sh b/core/precise-date/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/core/precise-date/.kokoro/lint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -# Install and link samples -if [ -f samples/package.json ]; then - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. -fi - -pnpm run lint diff --git a/core/precise-date/.kokoro/populate-secrets.sh b/core/precise-date/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/core/precise-date/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is called in the early stage of `trampoline_v2.sh` to -# populate secrets needed for the CI builds. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - -# Populates requested secrets set in SECRET_MANAGER_KEYS - -# In Kokoro CI builds, we use the service account attached to the -# Kokoro VM. This means we need to setup auth on other CI systems. -# For local run, we just use the gcloud command for retrieving the -# secrets. - -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - GCLOUD_COMMANDS=( - "docker" - "run" - "--entrypoint=gcloud" - "--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}" - "gcr.io/google.com/cloudsdktool/cloud-sdk" - ) - if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - else - echo "Authentication for this CI system is not implemented yet." - exit 2 - # TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS. - fi -else - # For local run, use /dev/shm or temporary directory for - # KOKORO_GFILE_DIR. - if [[ -d "/dev/shm" ]]; then - export KOKORO_GFILE_DIR=/dev/shm - else - export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX) - fi - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - GCLOUD_COMMANDS=("gcloud") -fi - -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} - -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - "${GCLOUD_COMMANDS[@]}" \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret $key > \ - "$SECRET_LOCATION/$key" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - exit 2 - fi -done diff --git a/core/precise-date/.kokoro/presubmit/node18/common.cfg b/core/precise-date/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 3227c5c080ae..000000000000 --- a/core/precise-date/.kokoro/presubmit/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/test.sh" -} diff --git a/core/precise-date/.kokoro/presubmit/node18/samples-test.cfg b/core/precise-date/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index dbb53caa8dea..000000000000 --- a/core/precise-date/.kokoro/presubmit/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/precise-date/.kokoro/presubmit/node18/system-test.cfg b/core/precise-date/.kokoro/presubmit/node18/system-test.cfg deleted file mode 100644 index a5f00714e93c..000000000000 --- a/core/precise-date/.kokoro/presubmit/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/precise-date/.kokoro/presubmit/node18/test.cfg b/core/precise-date/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/precise-date/.kokoro/presubmit/windows/common.cfg b/core/precise-date/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/core/precise-date/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/core/precise-date/.kokoro/presubmit/windows/test.cfg b/core/precise-date/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index cf4f6806cad3..000000000000 --- a/core/precise-date/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-precise-date/core/precise-date/.kokoro/test.bat" diff --git a/core/precise-date/.kokoro/publish.sh b/core/precise-date/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/core/precise-date/.kokoro/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Start the releasetool reporter -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -cd $(dirname $0)/.. - -NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1) -echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc - -npm install -g pnpm@9 -pnpm install -npm pack . -# npm provides no way to specify, observe, or predict the name of the tarball -# file it generates. We have to look in the current directory for the freshest -# .tgz file. -TARBALL=$(ls -1 -t *.tgz | head -1) - -npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL" - -# Kokoro collects *.tgz and package-lock.json files and stores them in Placer -# so we can generate SBOMs and attestations. -# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files -# that happened to be installed with dependencies. -find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f \ No newline at end of file diff --git a/core/precise-date/.kokoro/release/common.cfg b/core/precise-date/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/core/precise-date/.kokoro/release/common.cfg +++ /dev/null @@ -1,8 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} diff --git a/core/precise-date/.kokoro/release/docs-devsite.cfg b/core/precise-date/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 17dfcbdc30e4..000000000000 --- a/core/precise-date/.kokoro/release/docs-devsite.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/release/docs-devsite.sh" -} diff --git a/core/precise-date/.kokoro/release/docs-devsite.sh b/core/precise-date/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/core/precise-date/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi - -npm install -g pnpm@9 -pnpm install -npm install -g pnpm@9 -pnpm install --no-save @google-cloud/cloud-rad@^0.4.0 -# publish docs to devsite -npx @google-cloud/cloud-rad . cloud-rad diff --git a/core/precise-date/.kokoro/release/docs.cfg b/core/precise-date/.kokoro/release/docs.cfg deleted file mode 100644 index 28160e5cde9f..000000000000 --- a/core/precise-date/.kokoro/release/docs.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/release/docs.sh" -} diff --git a/core/precise-date/.kokoro/release/docs.sh b/core/precise-date/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/core/precise-date/.kokoro/release/docs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# build jsdocs (Python is installed on the Node 18 docker image). -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi -npm install -g pnpm@9 -pnpm install -pnpm run docs - -# create docs.metadata, based on package.json and .repo-metadata.json. -npm i json@9.0.6 -g -python3 -m docuploader create-metadata \ - --name=$(cat .repo-metadata.json | json name) \ - --version=$(cat package.json | json version) \ - --language=$(cat .repo-metadata.json | json language) \ - --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ - --product-page=$(cat .repo-metadata.json | json product_documentation) \ - --github-repository=$(cat .repo-metadata.json | json repo) \ - --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) -cp docs.metadata ./docs/docs.metadata - -# deploy the docs. -if [[ -z "$CREDENTIALS" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi -if [[ -z "$BUCKET" ]]; then - BUCKET=docs-staging -fi -python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/core/precise-date/.kokoro/release/publish.cfg b/core/precise-date/.kokoro/release/publish.cfg deleted file mode 100644 index 2c098bc9f3db..000000000000 --- a/core/precise-date/.kokoro/release/publish.cfg +++ /dev/null @@ -1,51 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-precise-date/core/precise-date/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-precise-date/core/precise-date/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.org and their corresponding -# package-lock.jsons in Placer. That way, we have a record of exactly -# what we published, and which version of which tools we used to publish -# it, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/**/*.tgz" - regex: "github/**/package-lock.json" - strip_prefix: "github" - } -} diff --git a/core/precise-date/.kokoro/samples-test.sh b/core/precise-date/.kokoro/samples-test.sh deleted file mode 100755 index 16b4a5e95b2a..000000000000 --- a/core/precise-date/.kokoro/samples-test.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p $NPM_CONFIG_PREFIX -npm config -g ls || npm i -g npm@`npm --version` - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-samples-test.sh is in the project -if [ -f .kokoro/pre-samples-test.sh ]; then - set +x - . .kokoro/pre-samples-test.sh - set -x -fi - -if [ -f samples/package.json ]; then - npm install -g pnpm@9 - pnpm install - - # Install and link samples - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. - # If tests are running against main branch, configure flakybot - # to open issues on failures: - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP - fi - - pnpm run samples-test -fi - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/precise-date/.kokoro/system-test.sh b/core/precise-date/.kokoro/system-test.sh deleted file mode 100755 index 8373c5149ee6..000000000000 --- a/core/precise-date/.kokoro/system-test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-system-test.sh is in the project -if [ -f .kokoro/pre-system-test.sh ]; then - set +x - . .kokoro/pre-system-test.sh - set -x -fi - -npm install -g pnpm@9 -pnpm install - -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi - -pnpm run system-test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/precise-date/.kokoro/test.bat b/core/precise-date/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/core/precise-date/.kokoro/test.bat +++ /dev/null @@ -1,33 +0,0 @@ -@rem Copyright 2018 Google LLC. All rights reserved. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@echo "Starting Windows build" - -cd /d %~dp0 -cd .. - -@rem npm path is not currently set in our image, we should fix this next time -@rem we upgrade Node.js in the image: -SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm - -call nvm use 18 -call which node - -call npm install || goto :error -call npm run test || goto :error - -goto :EOF - -:error -exit /b 1 diff --git a/core/precise-date/.kokoro/test.sh b/core/precise-date/.kokoro/test.sh deleted file mode 100755 index ce54eddd8e2d..000000000000 --- a/core/precise-date/.kokoro/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi -# Unit tests exercise the entire API surface, which may include -# deprecation warnings: -export MOCHA_THROW_DEPRECATION=false -pnpm test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=18 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/precise-date/.kokoro/trampoline.sh b/core/precise-date/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/core/precise-date/.kokoro/trampoline.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is not used any more, but we keep this file for making it -# easy to roll back. -# TODO: Remove this file from the template. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/core/precise-date/.kokoro/trampoline_v2.sh b/core/precise-date/.kokoro/trampoline_v2.sh deleted file mode 100755 index 9db7f49f00af..000000000000 --- a/core/precise-date/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# trampoline_v2.sh -# -# If you want to make a change to this file, consider doing so at: -# https://github.com/googlecloudplatform/docker-ci-helper -# -# This script is for running CI builds. For Kokoro builds, we -# set this script to `build_file` field in the Kokoro configuration. - -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. -# -# Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:18-user \ -# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ -# .kokoro/trampoline_v2.sh - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.7" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" - # Contains path to build artifacts being executed. - "KOKORO_BUILD_ARTIFACTS_SUBDIR" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For flakybot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")/core/precise-date" -else - PROJECT_ROOT="$(repo_root $(pwd))/core/precise-date" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# Auto-injected conditional check -# Check if the package directory has changes. If not, skip tests. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # The package path is hardcoded during migration - RELATIVE_PKG_PATH="core/precise-date" - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - # Safe default: HEAD~1..HEAD - DIFF_RANGE="HEAD~1..HEAD" - - if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then - echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." - exit 0 - else - echo "Changes detected in ${RELATIVE_PKG_PATH}. Proceeding with tests." - fi -fi - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/core/precise-date/.trampolinerc b/core/precise-date/.trampolinerc deleted file mode 100644 index f968f490e685..000000000000 --- a/core/precise-date/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/core/precise-date/.kokoro/populate-secrets.sh diff --git a/core/precise-date/package.json b/core/precise-date/package.json index 54192943d16d..218c546b11b2 100644 --- a/core/precise-date/package.json +++ b/core/precise-date/package.json @@ -18,10 +18,8 @@ "prepare": "npm run compile", "pretest": "npm run compile", "docs": "mkdir docs && touch docs/noop.html", - "presystem-test": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test", - "prelint": "cd samples; npm link ../; npm install", + "samples-test": "echo 'no samples tests'", + "system-test": "echo 'no system tests'", "precompile": "gts clean" }, "keywords": [ diff --git a/core/precise-date/system-test/system.ts b/core/precise-date/system-test/system.ts deleted file mode 100644 index 05638eda311f..000000000000 --- a/core/precise-date/system-test/system.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -console.warn('no system tests available 👻'); diff --git a/core/precise-date/tsconfig.json b/core/precise-date/tsconfig.json index 19523cc8baf3..30e77f361d20 100644 --- a/core/precise-date/tsconfig.json +++ b/core/precise-date/tsconfig.json @@ -10,7 +10,6 @@ }, "include": [ "src/*.ts", - "test/*.ts", - "system-test/*.ts" + "test/*.ts" ] } diff --git a/core/projectify/.kokoro/common.cfg b/core/projectify/.kokoro/common.cfg deleted file mode 100644 index 7db6cfab4310..000000000000 --- a/core/projectify/.kokoro/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/test.sh" -} diff --git a/core/projectify/.kokoro/continuous/node18/common.cfg b/core/projectify/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 7db6cfab4310..000000000000 --- a/core/projectify/.kokoro/continuous/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/test.sh" -} diff --git a/core/projectify/.kokoro/continuous/node18/lint.cfg b/core/projectify/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index b595dbce9230..000000000000 --- a/core/projectify/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/lint.sh" -} diff --git a/core/projectify/.kokoro/continuous/node18/samples-test.cfg b/core/projectify/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index d61768a96cc0..000000000000 --- a/core/projectify/.kokoro/continuous/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/projectify/.kokoro/continuous/node18/system-test.cfg b/core/projectify/.kokoro/continuous/node18/system-test.cfg deleted file mode 100644 index 902859cf2d87..000000000000 --- a/core/projectify/.kokoro/continuous/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/projectify/.kokoro/continuous/node18/test.cfg b/core/projectify/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/projectify/.kokoro/docs.sh b/core/projectify/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/core/projectify/.kokoro/docs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/core/projectify/.kokoro/lint.sh b/core/projectify/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/core/projectify/.kokoro/lint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -# Install and link samples -if [ -f samples/package.json ]; then - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. -fi - -pnpm run lint diff --git a/core/projectify/.kokoro/populate-secrets.sh b/core/projectify/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/core/projectify/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is called in the early stage of `trampoline_v2.sh` to -# populate secrets needed for the CI builds. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - -# Populates requested secrets set in SECRET_MANAGER_KEYS - -# In Kokoro CI builds, we use the service account attached to the -# Kokoro VM. This means we need to setup auth on other CI systems. -# For local run, we just use the gcloud command for retrieving the -# secrets. - -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - GCLOUD_COMMANDS=( - "docker" - "run" - "--entrypoint=gcloud" - "--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}" - "gcr.io/google.com/cloudsdktool/cloud-sdk" - ) - if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - else - echo "Authentication for this CI system is not implemented yet." - exit 2 - # TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS. - fi -else - # For local run, use /dev/shm or temporary directory for - # KOKORO_GFILE_DIR. - if [[ -d "/dev/shm" ]]; then - export KOKORO_GFILE_DIR=/dev/shm - else - export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX) - fi - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - GCLOUD_COMMANDS=("gcloud") -fi - -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} - -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - "${GCLOUD_COMMANDS[@]}" \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret $key > \ - "$SECRET_LOCATION/$key" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - exit 2 - fi -done diff --git a/core/projectify/.kokoro/presubmit/node18/common.cfg b/core/projectify/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 7db6cfab4310..000000000000 --- a/core/projectify/.kokoro/presubmit/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/test.sh" -} diff --git a/core/projectify/.kokoro/presubmit/node18/samples-test.cfg b/core/projectify/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index d61768a96cc0..000000000000 --- a/core/projectify/.kokoro/presubmit/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/projectify/.kokoro/presubmit/node18/test.cfg b/core/projectify/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/projectify/.kokoro/presubmit/windows/common.cfg b/core/projectify/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/core/projectify/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/core/projectify/.kokoro/presubmit/windows/test.cfg b/core/projectify/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index d483c117d9db..000000000000 --- a/core/projectify/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-projectify/core/projectify/.kokoro/test.bat" diff --git a/core/projectify/.kokoro/publish.sh b/core/projectify/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/core/projectify/.kokoro/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Start the releasetool reporter -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -cd $(dirname $0)/.. - -NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1) -echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc - -npm install -g pnpm@9 -pnpm install -npm pack . -# npm provides no way to specify, observe, or predict the name of the tarball -# file it generates. We have to look in the current directory for the freshest -# .tgz file. -TARBALL=$(ls -1 -t *.tgz | head -1) - -npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL" - -# Kokoro collects *.tgz and package-lock.json files and stores them in Placer -# so we can generate SBOMs and attestations. -# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files -# that happened to be installed with dependencies. -find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f \ No newline at end of file diff --git a/core/projectify/.kokoro/release/common.cfg b/core/projectify/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/core/projectify/.kokoro/release/common.cfg +++ /dev/null @@ -1,8 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} diff --git a/core/projectify/.kokoro/release/docs-devsite.cfg b/core/projectify/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 7276485fcb5b..000000000000 --- a/core/projectify/.kokoro/release/docs-devsite.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/release/docs-devsite.sh" -} diff --git a/core/projectify/.kokoro/release/docs-devsite.sh b/core/projectify/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/core/projectify/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi - -npm install -g pnpm@9 -pnpm install -npm install -g pnpm@9 -pnpm install --no-save @google-cloud/cloud-rad@^0.4.0 -# publish docs to devsite -npx @google-cloud/cloud-rad . cloud-rad diff --git a/core/projectify/.kokoro/release/docs.cfg b/core/projectify/.kokoro/release/docs.cfg deleted file mode 100644 index fa8a9dc3969d..000000000000 --- a/core/projectify/.kokoro/release/docs.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/release/docs.sh" -} diff --git a/core/projectify/.kokoro/release/docs.sh b/core/projectify/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/core/projectify/.kokoro/release/docs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# build jsdocs (Python is installed on the Node 18 docker image). -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi -npm install -g pnpm@9 -pnpm install -pnpm run docs - -# create docs.metadata, based on package.json and .repo-metadata.json. -npm i json@9.0.6 -g -python3 -m docuploader create-metadata \ - --name=$(cat .repo-metadata.json | json name) \ - --version=$(cat package.json | json version) \ - --language=$(cat .repo-metadata.json | json language) \ - --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ - --product-page=$(cat .repo-metadata.json | json product_documentation) \ - --github-repository=$(cat .repo-metadata.json | json repo) \ - --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) -cp docs.metadata ./docs/docs.metadata - -# deploy the docs. -if [[ -z "$CREDENTIALS" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi -if [[ -z "$BUCKET" ]]; then - BUCKET=docs-staging -fi -python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/core/projectify/.kokoro/release/publish.cfg b/core/projectify/.kokoro/release/publish.cfg deleted file mode 100644 index 06e58d28cbc8..000000000000 --- a/core/projectify/.kokoro/release/publish.cfg +++ /dev/null @@ -1,51 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-projectify/core/projectify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-projectify/core/projectify/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.org and their corresponding -# package-lock.jsons in Placer. That way, we have a record of exactly -# what we published, and which version of which tools we used to publish -# it, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/**/*.tgz" - regex: "github/**/package-lock.json" - strip_prefix: "github" - } -} diff --git a/core/projectify/.kokoro/samples-test.sh b/core/projectify/.kokoro/samples-test.sh deleted file mode 100755 index 8c554e68e0d9..000000000000 --- a/core/projectify/.kokoro/samples-test.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p $NPM_CONFIG_PREFIX -npm config -g ls || npm i -g npm@`npm --version` - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-samples-test.sh is in the project -if [ -f .kokoro/pre-samples-test.sh ]; then - set +x - . .kokoro/pre-samples-test.sh - set -x -fi - -if [ -f samples/package.json ]; then - npm install -g pnpm@9 - pnpm install - - # Install and link samples - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. - # If tests are running against main branch, configure flakybot - # to open issues on failures: - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP - fi - - pnpm run samples-test -fi - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/projectify/.kokoro/system-test.sh b/core/projectify/.kokoro/system-test.sh deleted file mode 100755 index 684bc3da4b81..000000000000 --- a/core/projectify/.kokoro/system-test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-system-test.sh is in the project -if [ -f .kokoro/pre-system-test.sh ]; then - set +x - . .kokoro/pre-system-test.sh - set -x -fi - -npm install -g pnpm@9 -pnpm install - -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi - -pnpm run system-test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/projectify/.kokoro/test.bat b/core/projectify/.kokoro/test.bat deleted file mode 100644 index 0bb12405231d..000000000000 --- a/core/projectify/.kokoro/test.bat +++ /dev/null @@ -1,33 +0,0 @@ -@rem Copyright 2018 Google LLC. All rights reserved. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@echo "Starting Windows build" - -cd /d %~dp0 -cd .. - -@rem npm path is not currently set in our image, we should fix this next time -@rem we upgrade Node.js in the image: -SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm - -call nvm use v14.17.3 -call which node - -call npm install || goto :error -call npm run test || goto :error - -goto :EOF - -:error -exit /b 1 diff --git a/core/projectify/.kokoro/test.sh b/core/projectify/.kokoro/test.sh deleted file mode 100755 index dbdedcb310de..000000000000 --- a/core/projectify/.kokoro/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi -# Unit tests exercise the entire API surface, which may include -# deprecation warnings: -export MOCHA_THROW_DEPRECATION=false -pnpm test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/projectify/.kokoro/trampoline.sh b/core/projectify/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/core/projectify/.kokoro/trampoline.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is not used any more, but we keep this file for making it -# easy to roll back. -# TODO: Remove this file from the template. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/core/projectify/.kokoro/trampoline_v2.sh b/core/projectify/.kokoro/trampoline_v2.sh deleted file mode 100755 index f6a5f9ab9b5c..000000000000 --- a/core/projectify/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# trampoline_v2.sh -# -# If you want to make a change to this file, consider doing so at: -# https://github.com/googlecloudplatform/docker-ci-helper -# -# This script is for running CI builds. For Kokoro builds, we -# set this script to `build_file` field in the Kokoro configuration. - -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. -# -# Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ -# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ -# .kokoro/trampoline_v2.sh - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.7" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" - # Contains path to build artifacts being executed. - "KOKORO_BUILD_ARTIFACTS_SUBDIR" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For flakybot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")/core/projectify" -else - PROJECT_ROOT="$(repo_root $(pwd))/core/projectify" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# Auto-injected conditional check -# Check if the package directory has changes. If not, skip tests. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # The package path is hardcoded during migration - RELATIVE_PKG_PATH="core/projectify" - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - # Safe default: HEAD~1..HEAD - DIFF_RANGE="HEAD~1..HEAD" - - if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then - echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." - exit 0 - else - echo "Changes detected in ${RELATIVE_PKG_PATH}. Proceeding with tests." - fi -fi - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/core/projectify/.trampolinerc b/core/projectify/.trampolinerc deleted file mode 100644 index 6d691505b3f6..000000000000 --- a/core/projectify/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/core/projectify/.kokoro/populate-secrets.sh diff --git a/core/promisify/.kokoro/common.cfg b/core/promisify/.kokoro/common.cfg deleted file mode 100644 index 1c4b8fcc21a6..000000000000 --- a/core/promisify/.kokoro/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/test.sh" -} diff --git a/core/promisify/.kokoro/continuous/node18/common.cfg b/core/promisify/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 1c4b8fcc21a6..000000000000 --- a/core/promisify/.kokoro/continuous/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/test.sh" -} diff --git a/core/promisify/.kokoro/continuous/node18/lint.cfg b/core/promisify/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index 2ba46c5102d4..000000000000 --- a/core/promisify/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/lint.sh" -} diff --git a/core/promisify/.kokoro/continuous/node18/samples-test.cfg b/core/promisify/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index 06918ac2db85..000000000000 --- a/core/promisify/.kokoro/continuous/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/promisify/.kokoro/continuous/node18/system-test.cfg b/core/promisify/.kokoro/continuous/node18/system-test.cfg deleted file mode 100644 index 5e1c45c0e21c..000000000000 --- a/core/promisify/.kokoro/continuous/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/promisify/.kokoro/continuous/node18/test.cfg b/core/promisify/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/promisify/.kokoro/docs.sh b/core/promisify/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/core/promisify/.kokoro/docs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/core/promisify/.kokoro/lint.sh b/core/promisify/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/core/promisify/.kokoro/lint.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -# Install and link samples -if [ -f samples/package.json ]; then - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. -fi - -pnpm run lint diff --git a/core/promisify/.kokoro/populate-secrets.sh b/core/promisify/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/core/promisify/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is called in the early stage of `trampoline_v2.sh` to -# populate secrets needed for the CI builds. - -set -eo pipefail - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - -# Populates requested secrets set in SECRET_MANAGER_KEYS - -# In Kokoro CI builds, we use the service account attached to the -# Kokoro VM. This means we need to setup auth on other CI systems. -# For local run, we just use the gcloud command for retrieving the -# secrets. - -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - GCLOUD_COMMANDS=( - "docker" - "run" - "--entrypoint=gcloud" - "--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}" - "gcr.io/google.com/cloudsdktool/cloud-sdk" - ) - if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - else - echo "Authentication for this CI system is not implemented yet." - exit 2 - # TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS. - fi -else - # For local run, use /dev/shm or temporary directory for - # KOKORO_GFILE_DIR. - if [[ -d "/dev/shm" ]]; then - export KOKORO_GFILE_DIR=/dev/shm - else - export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX) - fi - SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" - GCLOUD_COMMANDS=("gcloud") -fi - -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} - -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - "${GCLOUD_COMMANDS[@]}" \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret $key > \ - "$SECRET_LOCATION/$key" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - exit 2 - fi -done diff --git a/core/promisify/.kokoro/presubmit/node18/common.cfg b/core/promisify/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 1c4b8fcc21a6..000000000000 --- a/core/promisify/.kokoro/presubmit/node18/common.cfg +++ /dev/null @@ -1,24 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - } -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/test.sh" -} diff --git a/core/promisify/.kokoro/presubmit/node18/samples-test.cfg b/core/promisify/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index 06918ac2db85..000000000000 --- a/core/promisify/.kokoro/presubmit/node18/samples-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/promisify/.kokoro/presubmit/node18/system-test.cfg b/core/promisify/.kokoro/presubmit/node18/system-test.cfg deleted file mode 100644 index 5e1c45c0e21c..000000000000 --- a/core/promisify/.kokoro/presubmit/node18/system-test.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/system-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "long-door-651-kokoro-system-test-service-account" -} \ No newline at end of file diff --git a/core/promisify/.kokoro/presubmit/node18/test.cfg b/core/promisify/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/promisify/.kokoro/presubmit/windows/common.cfg b/core/promisify/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/core/promisify/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/core/promisify/.kokoro/presubmit/windows/test.cfg b/core/promisify/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index dcb0c05f5d84..000000000000 --- a/core/promisify/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-promisify/core/promisify/.kokoro/test.bat" diff --git a/core/promisify/.kokoro/publish.sh b/core/promisify/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/core/promisify/.kokoro/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Start the releasetool reporter -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -cd $(dirname $0)/.. - -NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1) -echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc - -npm install -g pnpm@9 -pnpm install -npm pack . -# npm provides no way to specify, observe, or predict the name of the tarball -# file it generates. We have to look in the current directory for the freshest -# .tgz file. -TARBALL=$(ls -1 -t *.tgz | head -1) - -npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL" - -# Kokoro collects *.tgz and package-lock.json files and stores them in Placer -# so we can generate SBOMs and attestations. -# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files -# that happened to be installed with dependencies. -find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f \ No newline at end of file diff --git a/core/promisify/.kokoro/release/common.cfg b/core/promisify/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/core/promisify/.kokoro/release/common.cfg +++ /dev/null @@ -1,8 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} diff --git a/core/promisify/.kokoro/release/docs-devsite.cfg b/core/promisify/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 1f2b0474e1cf..000000000000 --- a/core/promisify/.kokoro/release/docs-devsite.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/release/docs-devsite.sh" -} diff --git a/core/promisify/.kokoro/release/docs-devsite.sh b/core/promisify/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/core/promisify/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi - -npm install -g pnpm@9 -pnpm install -npm install -g pnpm@9 -pnpm install --no-save @google-cloud/cloud-rad@^0.4.0 -# publish docs to devsite -npx @google-cloud/cloud-rad . cloud-rad diff --git a/core/promisify/.kokoro/release/docs.cfg b/core/promisify/.kokoro/release/docs.cfg deleted file mode 100644 index 2f18a5dbabef..000000000000 --- a/core/promisify/.kokoro/release/docs.cfg +++ /dev/null @@ -1,26 +0,0 @@ -# service account used to publish up-to-date docs. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# doc publications use a Python image. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/release/docs.sh" -} diff --git a/core/promisify/.kokoro/release/docs.sh b/core/promisify/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/core/promisify/.kokoro/release/docs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# build jsdocs (Python is installed on the Node 18 docker image). -if [[ -z "$CREDENTIALS" ]]; then - # if CREDENTIALS are explicitly set, assume we're testing locally - # and don't set NPM_CONFIG_PREFIX. - export NPM_CONFIG_PREFIX=${HOME}/.npm-global - export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin" - cd $(dirname $0)/../.. -fi -npm install -g pnpm@9 -pnpm install -pnpm run docs - -# create docs.metadata, based on package.json and .repo-metadata.json. -npm i json@9.0.6 -g -python3 -m docuploader create-metadata \ - --name=$(cat .repo-metadata.json | json name) \ - --version=$(cat package.json | json version) \ - --language=$(cat .repo-metadata.json | json language) \ - --distribution-name=$(cat .repo-metadata.json | json distribution_name) \ - --product-page=$(cat .repo-metadata.json | json product_documentation) \ - --github-repository=$(cat .repo-metadata.json | json repo) \ - --issue-tracker=$(cat .repo-metadata.json | json issue_tracker) -cp docs.metadata ./docs/docs.metadata - -# deploy the docs. -if [[ -z "$CREDENTIALS" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi -if [[ -z "$BUCKET" ]]; then - BUCKET=docs-staging -fi -python3 -m docuploader upload ./docs --credentials $CREDENTIALS --staging-bucket $BUCKET diff --git a/core/promisify/.kokoro/release/publish.cfg b/core/promisify/.kokoro/release/publish.cfg deleted file mode 100644 index 0319af6333c9..000000000000 --- a/core/promisify/.kokoro/release/publish.cfg +++ /dev/null @@ -1,51 +0,0 @@ -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} - -# Download trampoline resources. -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" - -# Use the trampoline script to run in docker. -build_file: "nodejs-promisify/core/promisify/.kokoro/trampoline_v2.sh" - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-promisify/core/promisify/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.org and their corresponding -# package-lock.jsons in Placer. That way, we have a record of exactly -# what we published, and which version of which tools we used to publish -# it, which we can use to generate SBOMs and attestations. -action { - define_artifacts { - regex: "github/**/*.tgz" - regex: "github/**/package-lock.json" - strip_prefix: "github" - } -} diff --git a/core/promisify/.kokoro/samples-test.sh b/core/promisify/.kokoro/samples-test.sh deleted file mode 100755 index 8c554e68e0d9..000000000000 --- a/core/promisify/.kokoro/samples-test.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p $NPM_CONFIG_PREFIX -npm config -g ls || npm i -g npm@`npm --version` - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-samples-test.sh is in the project -if [ -f .kokoro/pre-samples-test.sh ]; then - set +x - . .kokoro/pre-samples-test.sh - set -x -fi - -if [ -f samples/package.json ]; then - npm install -g pnpm@9 - pnpm install - - # Install and link samples - cd samples/ - npm link ../ - npm install -g pnpm@9 - pnpm install - cd .. - # If tests are running against main branch, configure flakybot - # to open issues on failures: - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP - fi - - pnpm run samples-test -fi - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/promisify/.kokoro/system-test.sh b/core/promisify/.kokoro/system-test.sh deleted file mode 100755 index 684bc3da4b81..000000000000 --- a/core/promisify/.kokoro/system-test.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -# Run a pre-test hook, if a pre-system-test.sh is in the project -if [ -f .kokoro/pre-system-test.sh ]; then - set +x - . .kokoro/pre-system-test.sh - set -x -fi - -npm install -g pnpm@9 -pnpm install - -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi - -pnpm run system-test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/promisify/.kokoro/test.bat b/core/promisify/.kokoro/test.bat deleted file mode 100644 index 0bb12405231d..000000000000 --- a/core/promisify/.kokoro/test.bat +++ /dev/null @@ -1,33 +0,0 @@ -@rem Copyright 2018 Google LLC. All rights reserved. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -@echo "Starting Windows build" - -cd /d %~dp0 -cd .. - -@rem npm path is not currently set in our image, we should fix this next time -@rem we upgrade Node.js in the image: -SET PATH=%PATH%;/cygdrive/c/Program Files/nodejs/npm - -call nvm use v14.17.3 -call which node - -call npm install || goto :error -call npm run test || goto :error - -goto :EOF - -:error -exit /b 1 diff --git a/core/promisify/.kokoro/test.sh b/core/promisify/.kokoro/test.sh deleted file mode 100755 index dbdedcb310de..000000000000 --- a/core/promisify/.kokoro/test.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=${HOME}/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main branch, configure flakybot -# to open issues on failures: -if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then - export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml - export MOCHA_REPORTER=xunit - cleanup() { - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot - } - trap cleanup EXIT HUP -fi -# Unit tests exercise the entire API surface, which may include -# deprecation warnings: -export MOCHA_THROW_DEPRECATION=false -pnpm test - -# codecov combines coverage across integration and unit tests. Include -# the logic below for any environment you wish to collect coverage for: -COVERAGE_NODE=14 -if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then - NYC_BIN=./node_modules/nyc/bin/nyc.js - if [ -f "$NYC_BIN" ]; then - $NYC_BIN report || true - fi - bash $KOKORO_GFILE_DIR/codecov.sh -else - echo "coverage is only reported for Node $COVERAGE_NODE" -fi diff --git a/core/promisify/.kokoro/trampoline.sh b/core/promisify/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/core/promisify/.kokoro/trampoline.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is not used any more, but we keep this file for making it -# easy to roll back. -# TODO: Remove this file from the template. - -set -eo pipefail - -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/core/promisify/.kokoro/trampoline_v2.sh b/core/promisify/.kokoro/trampoline_v2.sh deleted file mode 100755 index 3cbeae9261a2..000000000000 --- a/core/promisify/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,510 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# trampoline_v2.sh -# -# If you want to make a change to this file, consider doing so at: -# https://github.com/googlecloudplatform/docker-ci-helper -# -# This script is for running CI builds. For Kokoro builds, we -# set this script to `build_file` field in the Kokoro configuration. - -# This script does 3 things. -# -# 1. Prepare the Docker image for the test -# 2. Run the Docker with appropriate flags to run the test -# 3. Upload the newly built Docker image -# -# in a way that is somewhat compatible with trampoline_v1. -# -# These environment variables are required: -# TRAMPOLINE_IMAGE: The docker image to use. -# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile. -# -# You can optionally change these environment variables: -# TRAMPOLINE_IMAGE_UPLOAD: -# (true|false): Whether to upload the Docker image after the -# successful builds. -# TRAMPOLINE_BUILD_FILE: The script to run in the docker container. -# TRAMPOLINE_WORKSPACE: The workspace path in the docker container. -# Defaults to /workspace. -# Potentially there are some repo specific envvars in .trampolinerc in -# the project root. -# -# Here is an example for running this script. -# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \ -# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \ -# .kokoro/trampoline_v2.sh - -set -euo pipefail - -TRAMPOLINE_VERSION="2.0.7" - -if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then - readonly IO_COLOR_RED="$(tput setaf 1)" - readonly IO_COLOR_GREEN="$(tput setaf 2)" - readonly IO_COLOR_YELLOW="$(tput setaf 3)" - readonly IO_COLOR_RESET="$(tput sgr0)" -else - readonly IO_COLOR_RED="" - readonly IO_COLOR_GREEN="" - readonly IO_COLOR_YELLOW="" - readonly IO_COLOR_RESET="" -fi - -function function_exists { - [ $(LC_ALL=C type -t $1)"" == "function" ] -} - -# Logs a message using the given color. The first argument must be one -# of the IO_COLOR_* variables defined above, such as -# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the -# given color. The log message will also have an RFC-3339 timestamp -# prepended (in UTC). You can disable the color output by setting -# TERM=vt100. -function log_impl() { - local color="$1" - shift - local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")" - echo "================================================================" - echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}" - echo "================================================================" -} - -# Logs the given message with normal coloring and a timestamp. -function log() { - log_impl "${IO_COLOR_RESET}" "$@" -} - -# Logs the given message in green with a timestamp. -function log_green() { - log_impl "${IO_COLOR_GREEN}" "$@" -} - -# Logs the given message in yellow with a timestamp. -function log_yellow() { - log_impl "${IO_COLOR_YELLOW}" "$@" -} - -# Logs the given message in red with a timestamp. -function log_red() { - log_impl "${IO_COLOR_RED}" "$@" -} - -readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX) -readonly tmphome="${tmpdir}/h" -mkdir -p "${tmphome}" - -function cleanup() { - rm -rf "${tmpdir}" -} -trap cleanup EXIT - -RUNNING_IN_CI="${RUNNING_IN_CI:-false}" - -# The workspace in the container, defaults to /workspace. -TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}" - -pass_down_envvars=( - # TRAMPOLINE_V2 variables. - # Tells scripts whether they are running as part of CI or not. - "RUNNING_IN_CI" - # Indicates which CI system we're in. - "TRAMPOLINE_CI" - # Indicates the version of the script. - "TRAMPOLINE_VERSION" - # Contains path to build artifacts being executed. - "KOKORO_BUILD_ARTIFACTS_SUBDIR" -) - -log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}" - -# Detect which CI systems we're in. If we're in any of the CI systems -# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be -# the name of the CI system. Both envvars will be passing down to the -# container for telling which CI system we're in. -if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then - # descriptive env var for indicating it's on CI. - RUNNING_IN_CI="true" - TRAMPOLINE_CI="kokoro" - if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then - if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then - log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting." - exit 1 - fi - # This service account will be activated later. - TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" - else - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - gcloud auth list - fi - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet - fi - pass_down_envvars+=( - # KOKORO dynamic variables. - "KOKORO_BUILD_NUMBER" - "KOKORO_BUILD_ID" - "KOKORO_JOB_NAME" - "KOKORO_GIT_COMMIT" - "KOKORO_GITHUB_COMMIT" - "KOKORO_GITHUB_PULL_REQUEST_NUMBER" - "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For flakybot - "KOKORO_GITHUB_COMMIT_URL" - "KOKORO_GITHUB_PULL_REQUEST_URL" - ) -elif [[ "${TRAVIS:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="travis" - pass_down_envvars+=( - "TRAVIS_BRANCH" - "TRAVIS_BUILD_ID" - "TRAVIS_BUILD_NUMBER" - "TRAVIS_BUILD_WEB_URL" - "TRAVIS_COMMIT" - "TRAVIS_COMMIT_MESSAGE" - "TRAVIS_COMMIT_RANGE" - "TRAVIS_JOB_NAME" - "TRAVIS_JOB_NUMBER" - "TRAVIS_JOB_WEB_URL" - "TRAVIS_PULL_REQUEST" - "TRAVIS_PULL_REQUEST_BRANCH" - "TRAVIS_PULL_REQUEST_SHA" - "TRAVIS_PULL_REQUEST_SLUG" - "TRAVIS_REPO_SLUG" - "TRAVIS_SECURE_ENV_VARS" - "TRAVIS_TAG" - ) -elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="github-workflow" - pass_down_envvars+=( - "GITHUB_WORKFLOW" - "GITHUB_RUN_ID" - "GITHUB_RUN_NUMBER" - "GITHUB_ACTION" - "GITHUB_ACTIONS" - "GITHUB_ACTOR" - "GITHUB_REPOSITORY" - "GITHUB_EVENT_NAME" - "GITHUB_EVENT_PATH" - "GITHUB_SHA" - "GITHUB_REF" - "GITHUB_HEAD_REF" - "GITHUB_BASE_REF" - ) -elif [[ "${CIRCLECI:-}" == "true" ]]; then - RUNNING_IN_CI="true" - TRAMPOLINE_CI="circleci" - pass_down_envvars+=( - "CIRCLE_BRANCH" - "CIRCLE_BUILD_NUM" - "CIRCLE_BUILD_URL" - "CIRCLE_COMPARE_URL" - "CIRCLE_JOB" - "CIRCLE_NODE_INDEX" - "CIRCLE_NODE_TOTAL" - "CIRCLE_PREVIOUS_BUILD_NUM" - "CIRCLE_PROJECT_REPONAME" - "CIRCLE_PROJECT_USERNAME" - "CIRCLE_REPOSITORY_URL" - "CIRCLE_SHA1" - "CIRCLE_STAGE" - "CIRCLE_USERNAME" - "CIRCLE_WORKFLOW_ID" - "CIRCLE_WORKFLOW_JOB_ID" - "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS" - "CIRCLE_WORKFLOW_WORKSPACE_ID" - ) -fi - -# Configure the service account for pulling the docker image. -function repo_root() { - local dir="$1" - while [[ ! -d "${dir}/.git" ]]; do - dir="$(dirname "$dir")" - done - echo "${dir}" -} - -# Detect the project root. In CI builds, we assume the script is in -# the git tree and traverse from there, otherwise, traverse from `pwd` -# to find `.git` directory. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - PROGRAM_PATH="$(realpath "$0")" - PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")" - PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")/core/promisify" -else - PROJECT_ROOT="$(repo_root $(pwd))/core/promisify" -fi - -log_yellow "Changing to the project root: ${PROJECT_ROOT}." -cd "${PROJECT_ROOT}" - -# Auto-injected conditional check -# Check if the package directory has changes. If not, skip tests. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # The package path is hardcoded during migration - RELATIVE_PKG_PATH="core/promisify" - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - # Safe default: HEAD~1..HEAD - DIFF_RANGE="HEAD~1..HEAD" - - if git diff --quiet "${DIFF_RANGE}" -- "${RELATIVE_PKG_PATH}"; then - echo "No changes detected in ${RELATIVE_PKG_PATH}. Skipping tests." - exit 0 - else - echo "Changes detected in ${RELATIVE_PKG_PATH}. Proceeding with tests." - fi -fi - -# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need -# to use this environment variable in `PROJECT_ROOT`. -if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then - - mkdir -p "${tmpdir}/gcloud" - gcloud_config_dir="${tmpdir}/gcloud" - - log_yellow "Using isolated gcloud config: ${gcloud_config_dir}." - export CLOUDSDK_CONFIG="${gcloud_config_dir}" - - log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication." - gcloud auth activate-service-account \ - --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}" - log_yellow "Configuring Container Registry access" - gcloud auth configure-docker --quiet -fi - -required_envvars=( - # The basic trampoline configurations. - "TRAMPOLINE_IMAGE" - "TRAMPOLINE_BUILD_FILE" -) - -if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then - source "${PROJECT_ROOT}/.trampolinerc" -fi - -log_yellow "Checking environment variables." -for e in "${required_envvars[@]}" -do - if [[ -z "${!e:-}" ]]; then - log "Missing ${e} env var. Aborting." - exit 1 - fi -done - -# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1 -# script: e.g. "github/repo-name/.kokoro/run_tests.sh" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}" -log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}" - -# ignore error on docker operations and test execution -set +e - -log_yellow "Preparing Docker image." -# We only download the docker image in CI builds. -if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - # Download the docker image specified by `TRAMPOLINE_IMAGE` - - # We may want to add --max-concurrent-downloads flag. - - log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}." - if docker pull "${TRAMPOLINE_IMAGE}"; then - log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="true" - else - log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}." - has_image="false" - fi -else - # For local run, check if we have the image. - if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then - has_image="true" - else - has_image="false" - fi -fi - - -# The default user for a Docker container has uid 0 (root). To avoid -# creating root-owned files in the build directory we tell docker to -# use the current user ID. -user_uid="$(id -u)" -user_gid="$(id -g)" -user_name="$(id -un)" - -# To allow docker in docker, we add the user to the docker group in -# the host os. -docker_gid=$(cut -d: -f3 < <(getent group docker)) - -update_cache="false" -if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then - # Build the Docker image from the source. - context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}") - docker_build_flags=( - "-f" "${TRAMPOLINE_DOCKERFILE}" - "-t" "${TRAMPOLINE_IMAGE}" - "--build-arg" "UID=${user_uid}" - "--build-arg" "USERNAME=${user_name}" - ) - if [[ "${has_image}" == "true" ]]; then - docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}") - fi - - log_yellow "Start building the docker image." - if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then - echo "docker build" "${docker_build_flags[@]}" "${context_dir}" - fi - - # ON CI systems, we want to suppress docker build logs, only - # output the logs when it fails. - if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then - if docker build "${docker_build_flags[@]}" "${context_dir}" \ - > "${tmpdir}/docker_build.log" 2>&1; then - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - cat "${tmpdir}/docker_build.log" - fi - - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - log_yellow "Dumping the build logs:" - cat "${tmpdir}/docker_build.log" - exit 1 - fi - else - if docker build "${docker_build_flags[@]}" "${context_dir}"; then - log_green "Finished building the docker image." - update_cache="true" - else - log_red "Failed to build the Docker image, aborting." - exit 1 - fi - fi -else - if [[ "${has_image}" != "true" ]]; then - log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting." - exit 1 - fi -fi - -# We use an array for the flags so they are easier to document. -docker_flags=( - # Remove the container after it exists. - "--rm" - - # Use the host network. - "--network=host" - - # Run in priviledged mode. We are not using docker for sandboxing or - # isolation, just for packaging our dev tools. - "--privileged" - - # Run the docker script with the user id. Because the docker image gets to - # write in ${PWD} you typically want this to be your user id. - # To allow docker in docker, we need to use docker gid on the host. - "--user" "${user_uid}:${docker_gid}" - - # Pass down the USER. - "--env" "USER=${user_name}" - - # Mount the project directory inside the Docker container. - "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}" - "--workdir" "${TRAMPOLINE_WORKSPACE}" - "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}" - - # Mount the temporary home directory. - "--volume" "${tmphome}:/h" - "--env" "HOME=/h" - - # Allow docker in docker. - "--volume" "/var/run/docker.sock:/var/run/docker.sock" - - # Mount the /tmp so that docker in docker can mount the files - # there correctly. - "--volume" "/tmp:/tmp" - # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR - # TODO(tmatsuo): This part is not portable. - "--env" "TRAMPOLINE_SECRET_DIR=/secrets" - "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile" - "--env" "KOKORO_GFILE_DIR=/secrets/gfile" - "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore" - "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore" -) - -# Add an option for nicer output if the build gets a tty. -if [[ -t 0 ]]; then - docker_flags+=("-it") -fi - -# Passing down env vars -for e in "${pass_down_envvars[@]}" -do - if [[ -n "${!e:-}" ]]; then - docker_flags+=("--env" "${e}=${!e}") - fi -done - -# If arguments are given, all arguments will become the commands run -# in the container, otherwise run TRAMPOLINE_BUILD_FILE. -if [[ $# -ge 1 ]]; then - log_yellow "Running the given commands '" "${@:1}" "' in the container." - readonly commands=("${@:1}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}" -else - log_yellow "Running the tests in a Docker container." - docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}") - if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then - echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" - fi - docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" -fi - - -test_retval=$? - -if [[ ${test_retval} -eq 0 ]]; then - log_green "Build finished with ${test_retval}" -else - log_red "Build finished with ${test_retval}" -fi - -# Only upload it when the test passes. -if [[ "${update_cache}" == "true" ]] && \ - [[ $test_retval == 0 ]] && \ - [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then - log_yellow "Uploading the Docker image." - if docker push "${TRAMPOLINE_IMAGE}"; then - log_green "Finished uploading the Docker image." - else - log_red "Failed uploading the Docker image." - fi - # Call trampoline_after_upload_hook if it's defined. - if function_exists trampoline_after_upload_hook; then - trampoline_after_upload_hook - fi - -fi - -exit "${test_retval}" diff --git a/core/promisify/.trampolinerc b/core/promisify/.trampolinerc deleted file mode 100644 index 91b558756655..000000000000 --- a/core/promisify/.trampolinerc +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Template for .trampolinerc - -# Add required env vars here. -required_envvars+=( -) - -# Add env vars which are passed down into the container here. -pass_down_envvars+=( - "AUTORELEASE_PR" - "VERSION" -) - -# Prevent unintentional override on the default image. -if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \ - [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image." - exit 1 -fi - -# Define the default value if it makes sense. -if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then - TRAMPOLINE_IMAGE_UPLOAD="" -fi - -if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then - TRAMPOLINE_IMAGE="" -fi - -if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then - TRAMPOLINE_DOCKERFILE="" -fi - -if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then - TRAMPOLINE_BUILD_FILE="" -fi - -# Secret Manager secrets. -source ${PROJECT_ROOT}/core/promisify/.kokoro/populate-secrets.sh diff --git a/core/promisify/package.json b/core/promisify/package.json index 8ff0385e8598..27c682c91248 100644 --- a/core/promisify/package.json +++ b/core/promisify/package.json @@ -17,10 +17,8 @@ "prepare": "npm run compile", "pretest": "npm run compile", "docs": "jsdoc -c .jsdoc.js", - "presystem-test": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha build/system-test", - "prelint": "cd samples; npm link ../; npm install", + "samples-test": "echo 'no samples tests'", + "system-test": "echo 'no system tests'", "clean": "gts clean", "precompile": "gts clean" }, diff --git a/core/promisify/system-test/system.ts b/core/promisify/system-test/system.ts deleted file mode 100644 index 05638eda311f..000000000000 --- a/core/promisify/system-test/system.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -console.warn('no system tests available 👻'); diff --git a/core/promisify/tsconfig.json b/core/promisify/tsconfig.json index 8b14ad98550a..cd7761a8fcba 100644 --- a/core/promisify/tsconfig.json +++ b/core/promisify/tsconfig.json @@ -7,7 +7,6 @@ }, "include": [ "src/*.ts", - "test/*.ts", - "system-test/*.ts" + "test/*.ts" ] }