diff --git a/.github/workflows/mandatory-conformance.yaml b/.github/workflows/mandatory-conformance.yaml index a2a29a7d9cb4..196aefb1ea8b 100644 --- a/.github/workflows/mandatory-conformance.yaml +++ b/.github/workflows/mandatory-conformance.yaml @@ -51,8 +51,8 @@ jobs: - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version: '>=1.20.2' - - run: chmod +x .kokoro/mandatory-conformance.sh + - run: chmod +x ./scripts/mandatory-conformance.sh - uses: ./.github/actions/pnpm-lockfile-check - run: pnpm --filter ...{handwritten/bigtable} run --if-present compile - run: go version - - run: .kokoro/mandatory-conformance.sh + - run: ./scripts/mandatory-conformance.sh diff --git a/handwritten/bigtable/.kokoro/.gitattributes b/handwritten/bigtable/.kokoro/.gitattributes deleted file mode 100644 index 87acd4f484ee..000000000000 --- a/handwritten/bigtable/.kokoro/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* linguist-generated=true diff --git a/handwritten/bigtable/.kokoro/common.cfg b/handwritten/bigtable/.kokoro/common.cfg deleted file mode 100644 index cc8eca18c151..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/test.sh" -} diff --git a/handwritten/bigtable/.kokoro/continuous/node18/common.cfg b/handwritten/bigtable/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index cc8eca18c151..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/test.sh" -} diff --git a/handwritten/bigtable/.kokoro/continuous/node18/lint.cfg b/handwritten/bigtable/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index a22d14621738..000000000000 --- a/handwritten/bigtable/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/handwritten/bigtable/.kokoro/lint.sh" -} diff --git a/handwritten/bigtable/.kokoro/continuous/node18/samples-test.cfg b/handwritten/bigtable/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index b57b6da635b8..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/continuous/node18/test.cfg b/handwritten/bigtable/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/bigtable/.kokoro/docs.sh b/handwritten/bigtable/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/lint.sh b/handwritten/bigtable/.kokoro/lint.sh deleted file mode 100755 index d76b839d32d2..000000000000 --- a/handwritten/bigtable/.kokoro/lint.sh +++ /dev/null @@ -1,40 +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 -export PATH="${NPM_CONFIG_PREFIX}/bin:${PATH}" - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p ${NPM_CONFIG_PREFIX}/lib -npm config -g ls || npm i -g npm@`npm --version` - -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/handwritten/bigtable/.kokoro/populate-secrets.sh b/handwritten/bigtable/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/presubmit/node18/common.cfg b/handwritten/bigtable/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index cc8eca18c151..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/test.sh" -} diff --git a/handwritten/bigtable/.kokoro/presubmit/node18/samples-test.cfg b/handwritten/bigtable/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index b57b6da635b8..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/presubmit/node18/test.cfg b/handwritten/bigtable/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/bigtable/.kokoro/presubmit/windows/common.cfg b/handwritten/bigtable/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/handwritten/bigtable/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/handwritten/bigtable/.kokoro/presubmit/windows/test.cfg b/handwritten/bigtable/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index 6fed9d94cc95..000000000000 --- a/handwritten/bigtable/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-bigtable/handwritten/bigtable/.kokoro/test.bat" diff --git a/handwritten/bigtable/.kokoro/publish.sh b/handwritten/bigtable/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/release/common.cfg b/handwritten/bigtable/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/release/docs-devsite.cfg b/handwritten/bigtable/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 37a8e9ff97ef..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/handwritten/bigtable/.kokoro/release/docs-devsite.sh" -} diff --git a/handwritten/bigtable/.kokoro/release/docs-devsite.sh b/handwritten/bigtable/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/release/docs.cfg b/handwritten/bigtable/.kokoro/release/docs.cfg deleted file mode 100644 index 6c2fbf57c3ff..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-bigtable/handwritten/bigtable/.kokoro/release/docs.sh" -} diff --git a/handwritten/bigtable/.kokoro/release/docs.sh b/handwritten/bigtable/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/release/publish.cfg b/handwritten/bigtable/.kokoro/release/publish.cfg deleted file mode 100644 index 5ec8edcce5ea..000000000000 --- a/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.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-bigtable/handwritten/bigtable/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.com 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/handwritten/bigtable/.kokoro/samples-test.sh b/handwritten/bigtable/.kokoro/samples-test.sh deleted file mode 100755 index 94a782a6bbca..000000000000 --- a/handwritten/bigtable/.kokoro/samples-test.sh +++ /dev/null @@ -1,75 +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 - - # These are currently disabled pending figuring out admin quota issues. - exit 0 - 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/handwritten/bigtable/.kokoro/test.bat b/handwritten/bigtable/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/test.sh b/handwritten/bigtable/.kokoro/test.sh deleted file mode 100755 index c687f7370565..000000000000 --- a/handwritten/bigtable/.kokoro/test.sh +++ /dev/null @@ -1,55 +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 - - # These are currently disabled pending figuring out admin quota issues. - exit 0 -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/handwritten/bigtable/.kokoro/trampoline.sh b/handwritten/bigtable/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/handwritten/bigtable/.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/handwritten/bigtable/.kokoro/trampoline_v2.sh b/handwritten/bigtable/.kokoro/trampoline_v2.sh deleted file mode 100755 index 6c987ec04608..000000000000 --- a/handwritten/bigtable/.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/samples-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}")/handwritten/bigtable" -else - PROJECT_ROOT="$(repo_root $(pwd))/handwritten/bigtable" -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="handwritten/bigtable" - - 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/handwritten/bigtable/.trampolinerc b/handwritten/bigtable/.trampolinerc deleted file mode 100644 index a38a309cd7ef..000000000000 --- a/handwritten/bigtable/.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}/handwritten/bigtable/.kokoro/populate-secrets.sh diff --git a/handwritten/bigtable/cloudbuild.yaml b/handwritten/bigtable/cloudbuild.yaml index ef5dbbc30c9b..4ef8838210cf 100644 --- a/handwritten/bigtable/cloudbuild.yaml +++ b/handwritten/bigtable/cloudbuild.yaml @@ -37,29 +37,6 @@ steps: # - name: 'sa-keys' # path: '/secrets' -# 3. (Optional) Code Coverage Reporting -- name: 'node:24' - entrypoint: 'bash' - args: - - '-c' - - | - # Check if nyc is installed and run report - if [ -f ./node_modules/nyc/bin/nyc.js ]; then - ./node_modules/nyc/bin/nyc.js report || true # `|| true` prevents build failure if nyc report itself exits non-zero - else - echo "nyc not found, skipping coverage report." - fi - # The original codecov.sh script from Kokoro needs to be made available to GCB. - # Options: - # a) Commit codecov.sh into your repo (e.g., .kokoro/codecov.sh) and call it: - # if [ -f .kokoro/codecov.sh ]; then . ./.kokoro/codecov.sh; fi - # b) Replicate its functionality directly in this step. - # c) Store it in a GCS bucket and fetch it. - echo "Codecov reporting (if desired) would be integrated here." - dir: 'handwritten/bigtable' - id: 'coverage-report' - waitFor: ['run-system-tests'] - # If you use Secret Manager for credentials, uncomment and configure: # availableSecrets: # secretManager: diff --git a/handwritten/bigtable/package.json b/handwritten/bigtable/package.json index 3f96f7ec9648..25c83c7a7d3a 100644 --- a/handwritten/bigtable/package.json +++ b/handwritten/bigtable/package.json @@ -34,11 +34,8 @@ "predocs": "pnpm run compile", "docs": "jsdoc -c .jsdoc.js", "fix": "gts fix", - "prelint": "cd samples; pnpm link ../; pnpm install", "lint": "gts check", "prepare": "npm run compile-protos && npm run compile", - "samples-test": "cd samples/ && pnpm link ../ && pnpm install && pnpm test && cd ../", - "snippet-test": "node ../../bin/run-test.cjs samples/api-reference-doc-snippets/tests/*.js --timeout 600000 --retries 3", "presystem-test": "pnpm run compile", "system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000 --retries 3", "pretest": "pnpm run compile", diff --git a/handwritten/bigtable/.kokoro/mandatory-conformance.sh b/handwritten/bigtable/scripts/mandatory-conformance.sh old mode 100644 new mode 100755 similarity index 100% rename from handwritten/bigtable/.kokoro/mandatory-conformance.sh rename to handwritten/bigtable/scripts/mandatory-conformance.sh diff --git a/handwritten/datastore/.kokoro/.gitattributes b/handwritten/datastore/.kokoro/.gitattributes deleted file mode 100644 index 87acd4f484ee..000000000000 --- a/handwritten/datastore/.kokoro/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* linguist-generated=true diff --git a/handwritten/datastore/.kokoro/common.cfg b/handwritten/datastore/.kokoro/common.cfg deleted file mode 100644 index cd0eac3b1094..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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-datastore/handwritten/datastore/.kokoro/test.sh" -} diff --git a/handwritten/datastore/.kokoro/continuous/node18/common.cfg b/handwritten/datastore/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index cd0eac3b1094..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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-datastore/handwritten/datastore/.kokoro/test.sh" -} diff --git a/handwritten/datastore/.kokoro/continuous/node18/lint.cfg b/handwritten/datastore/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index a9237a559c4d..000000000000 --- a/handwritten/datastore/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/handwritten/datastore/.kokoro/lint.sh" -} diff --git a/handwritten/datastore/.kokoro/continuous/node18/samples-test.cfg b/handwritten/datastore/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index b3ff7d2569c0..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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/handwritten/datastore/.kokoro/continuous/node18/test.cfg b/handwritten/datastore/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/datastore/.kokoro/docs.sh b/handwritten/datastore/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/lint.sh b/handwritten/datastore/.kokoro/lint.sh deleted file mode 100755 index 925125aea64c..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/populate-secrets.sh b/handwritten/datastore/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/presubmit/node18/common.cfg b/handwritten/datastore/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index cd0eac3b1094..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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-datastore/handwritten/datastore/.kokoro/test.sh" -} diff --git a/handwritten/datastore/.kokoro/presubmit/node18/samples-test.cfg b/handwritten/datastore/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index b3ff7d2569c0..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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/handwritten/datastore/.kokoro/presubmit/node18/test.cfg b/handwritten/datastore/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/datastore/.kokoro/presubmit/windows/common.cfg b/handwritten/datastore/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/handwritten/datastore/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/handwritten/datastore/.kokoro/presubmit/windows/test.cfg b/handwritten/datastore/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index 3e1144899826..000000000000 --- a/handwritten/datastore/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-datastore/handwritten/datastore/.kokoro/test.bat" diff --git a/handwritten/datastore/.kokoro/publish.sh b/handwritten/datastore/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/release/common.cfg b/handwritten/datastore/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/release/docs-devsite.cfg b/handwritten/datastore/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index c843c9586d35..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/handwritten/datastore/.kokoro/release/docs-devsite.sh" -} diff --git a/handwritten/datastore/.kokoro/release/docs-devsite.sh b/handwritten/datastore/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/release/docs.cfg b/handwritten/datastore/.kokoro/release/docs.cfg deleted file mode 100644 index 9b2528c3521d..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-datastore/handwritten/datastore/.kokoro/release/docs.sh" -} diff --git a/handwritten/datastore/.kokoro/release/docs.sh b/handwritten/datastore/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/release/publish.cfg b/handwritten/datastore/.kokoro/release/publish.cfg deleted file mode 100644 index a670ddecac93..000000000000 --- a/handwritten/datastore/.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-datastore/handwritten/datastore/.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-datastore/handwritten/datastore/.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/handwritten/datastore/.kokoro/samples-test.sh b/handwritten/datastore/.kokoro/samples-test.sh deleted file mode 100755 index 16b4a5e95b2a..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/test.bat b/handwritten/datastore/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/test.sh b/handwritten/datastore/.kokoro/test.sh deleted file mode 100755 index ce54eddd8e2d..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/trampoline.sh b/handwritten/datastore/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/handwritten/datastore/.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/handwritten/datastore/.kokoro/trampoline_v2.sh b/handwritten/datastore/.kokoro/trampoline_v2.sh deleted file mode 100755 index 76c4c30eda8b..000000000000 --- a/handwritten/datastore/.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/samples-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}")/handwritten/datastore" -else - PROJECT_ROOT="$(repo_root $(pwd))/handwritten/datastore" -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="handwritten/datastore" - - 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/handwritten/datastore/.trampolinerc b/handwritten/datastore/.trampolinerc deleted file mode 100644 index a085b321d44b..000000000000 --- a/handwritten/datastore/.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}/handwritten/datastore/.kokoro/populate-secrets.sh diff --git a/handwritten/datastore/cloudbuild.yaml b/handwritten/datastore/cloudbuild.yaml index a8a82e5f75c7..57398bc8bc72 100644 --- a/handwritten/datastore/cloudbuild.yaml +++ b/handwritten/datastore/cloudbuild.yaml @@ -37,29 +37,6 @@ steps: # - name: 'sa-keys' # path: '/secrets' -# 3. (Optional) Code Coverage Reporting -- name: 'node:24' - entrypoint: 'bash' - args: - - '-c' - - | - # Check if nyc is installed and run report - if [ -f ./node_modules/nyc/bin/nyc.js ]; then - ./node_modules/nyc/bin/nyc.js report || true # `|| true` prevents build failure if nyc report itself exits non-zero - else - echo "nyc not found, skipping coverage report." - fi - # The original codecov.sh script from Kokoro needs to be made available to GCB. - # Options: - # a) Commit codecov.sh into your repo (e.g., .kokoro/codecov.sh) and call it: - # if [ -f .kokoro/codecov.sh ]; then . ./.kokoro/codecov.sh; fi - # b) Replicate its functionality directly in this step. - # c) Store it in a GCS bucket and fetch it. - echo "Codecov reporting (if desired) would be integrated here." - dir: 'handwritten/datastore' - id: 'coverage-report' - waitFor: ['run-system-tests'] - # If you use Secret Manager for credentials, uncomment and configure: # availableSecrets: # secretManager: diff --git a/handwritten/datastore/package.json b/handwritten/datastore/package.json index 4bab2a53e527..a6e4dc28a3a7 100644 --- a/handwritten/datastore/package.json +++ b/handwritten/datastore/package.json @@ -31,10 +31,8 @@ "compile": "tsc -p . && cp -r protos build && cp -r system-test/data build/system-test", "docs": "jsdoc -c .jsdoc.js", "fix": "gts fix", - "prelint": "cd samples; npm link ../; npm install", "lint": "gts check", "prepare": "npm run compile", - "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", "presystem-test": "npm run compile", "system-test": "node ../../bin/run-test.cjs build/system-test --timeout 600000", "pretest": "npm run compile", diff --git a/handwritten/firestore/.kokoro/common.cfg b/handwritten/firestore/.kokoro/common.cfg deleted file mode 100644 index 91d5007d8015..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/trampoline.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-firestore/handwritten/firestore/.kokoro/test.sh" -} diff --git a/handwritten/firestore/.kokoro/continuous/node18/common.cfg b/handwritten/firestore/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 91d5007d8015..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/trampoline.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-firestore/handwritten/firestore/.kokoro/test.sh" -} diff --git a/handwritten/firestore/.kokoro/continuous/node18/lint.cfg b/handwritten/firestore/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index 3875e4f978e4..000000000000 --- a/handwritten/firestore/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-firestore/handwritten/firestore/.kokoro/lint.sh" -} diff --git a/handwritten/firestore/.kokoro/continuous/node18/samples-test.cfg b/handwritten/firestore/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index 1ff4b5ffae57..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "nodejs-firestore/handwritten/firestore-ci-samples-71b5f8aee66e" -} diff --git a/handwritten/firestore/.kokoro/continuous/node18/test.cfg b/handwritten/firestore/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/firestore/.kokoro/docs.sh b/handwritten/firestore/.kokoro/docs.sh deleted file mode 100755 index 26a6c2791c93..000000000000 --- a/handwritten/firestore/.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/node/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run docs-test diff --git a/handwritten/firestore/.kokoro/lint.sh b/handwritten/firestore/.kokoro/lint.sh deleted file mode 100755 index 632a060d0d20..000000000000 --- a/handwritten/firestore/.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/node/.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/handwritten/firestore/.kokoro/populate-secrets.sh b/handwritten/firestore/.kokoro/populate-secrets.sh deleted file mode 100755 index 6f9d228859d3..000000000000 --- a/handwritten/firestore/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,43 +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. - -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 from service account: -# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com -SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" -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}" - docker run --entrypoint=gcloud \ - --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ - gcr.io/google.com/cloudsdktool/cloud-sdk \ - 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}" - fi -done diff --git a/handwritten/firestore/.kokoro/pre-samples-test.sh b/handwritten/firestore/.kokoro/pre-samples-test.sh deleted file mode 100755 index 9fcefbcc6e15..000000000000 --- a/handwritten/firestore/.kokoro/pre-samples-test.sh +++ /dev/null @@ -1,18 +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. - -export GCLOUD_PROJECT=nodejs-firestore/handwritten/firestore-ci -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/nodejs-firestore/handwritten/firestore-ci-samples-71b5f8aee66e diff --git a/handwritten/firestore/.kokoro/presubmit/node18/common.cfg b/handwritten/firestore/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 91d5007d8015..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/trampoline.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-firestore/handwritten/firestore/.kokoro/test.sh" -} diff --git a/handwritten/firestore/.kokoro/presubmit/node18/samples-test.cfg b/handwritten/firestore/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index 1ff4b5ffae57..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/samples-test.sh" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "nodejs-firestore/handwritten/firestore-ci-samples-71b5f8aee66e" -} diff --git a/handwritten/firestore/.kokoro/presubmit/node18/test.cfg b/handwritten/firestore/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/firestore/.kokoro/presubmit/windows/common.cfg b/handwritten/firestore/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/handwritten/firestore/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/handwritten/firestore/.kokoro/presubmit/windows/test.cfg b/handwritten/firestore/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index 603649c2ea95..000000000000 --- a/handwritten/firestore/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-firestore/handwritten/firestore/.kokoro/test.bat" diff --git a/handwritten/firestore/.kokoro/publish.sh b/handwritten/firestore/.kokoro/publish.sh deleted file mode 100755 index eb4f11bd2d59..000000000000 --- a/handwritten/firestore/.kokoro/publish.sh +++ /dev/null @@ -1,32 +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/node/.npm-global - -# Start the releasetool reporter -python3 -m pip install gcp-releasetool -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 publish --access=public --registry=https://wombat-dressing-room.appspot.com diff --git a/handwritten/firestore/.kokoro/release/common.cfg b/handwritten/firestore/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/handwritten/firestore/.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/handwritten/firestore/.kokoro/release/docs-devsite.cfg b/handwritten/firestore/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 4a47514ae0b0..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-firestore/handwritten/firestore/.kokoro/release/docs-devsite.sh" -} diff --git a/handwritten/firestore/.kokoro/release/docs-devsite.sh b/handwritten/firestore/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1e62c6638a1c..000000000000 --- a/handwritten/firestore/.kokoro/release/docs-devsite.sh +++ /dev/null @@ -1,31 +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 -npx @google-cloud/cloud-rad diff --git a/handwritten/firestore/.kokoro/release/docs.cfg b/handwritten/firestore/.kokoro/release/docs.cfg deleted file mode 100644 index 6f976e5a953e..000000000000 --- a/handwritten/firestore/.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-firestore/handwritten/firestore/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-firestore/handwritten/firestore/.kokoro/release/docs.sh" -} diff --git a/handwritten/firestore/.kokoro/release/docs.sh b/handwritten/firestore/.kokoro/release/docs.sh deleted file mode 100755 index 9d538eca2b8c..000000000000 --- a/handwritten/firestore/.kokoro/release/docs.sh +++ /dev/null @@ -1,51 +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/node/.npm-global - export PATH="$PATH:/home/node/.npm-global/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 pip install --user gcp-docuploader -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/handwritten/firestore/.kokoro/release/publish.cfg b/handwritten/firestore/.kokoro/release/publish.cfg deleted file mode 100644 index edc700c0e2ee..000000000000 --- a/handwritten/firestore/.kokoro/release/publish.cfg +++ /dev/null @@ -1,69 +0,0 @@ -# Get npm token from Keystore -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "google-cloud-npm-token-1" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Fetch magictoken to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "releasetool-magictoken" - } - } -} - -# Fetch api key to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "magic-github-proxy-api-key" - } - } -} - -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-firestore/handwritten/firestore/.kokoro/trampoline.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-firestore/handwritten/firestore/.kokoro/publish.sh" -} diff --git a/handwritten/firestore/.kokoro/samples-test.sh b/handwritten/firestore/.kokoro/samples-test.sh deleted file mode 100755 index e63397ea59f9..000000000000 --- a/handwritten/firestore/.kokoro/samples-test.sh +++ /dev/null @@ -1,70 +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/node/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json -export GCLOUD_PROJECT=node-gcloud-ci - -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, 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/handwritten/firestore/.kokoro/test.bat b/handwritten/firestore/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/handwritten/firestore/.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/handwritten/firestore/.kokoro/test.sh b/handwritten/firestore/.kokoro/test.sh deleted file mode 100755 index b72cc094108e..000000000000 --- a/handwritten/firestore/.kokoro/test.sh +++ /dev/null @@ -1,49 +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/node/.npm-global - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install -# If tests are running against main, 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 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/handwritten/firestore/.kokoro/trampoline.sh b/handwritten/firestore/.kokoro/trampoline.sh deleted file mode 100755 index ef9cb4a426d6..000000000000 --- a/handwritten/firestore/.kokoro/trampoline.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Copyright 2017 Google Inc. - -# 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="handwritten/firestore" - - 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 -# -# 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. - -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/handwritten/firestore/.trampolinerc b/handwritten/firestore/.trampolinerc deleted file mode 100644 index 2af668a017d0..000000000000 --- a/handwritten/firestore/.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}/handwritten/firestore/.kokoro/populate-secrets.sh diff --git a/handwritten/firestore/cloudbuild.yaml b/handwritten/firestore/cloudbuild.yaml index 22bbd8f61843..1772a57adf82 100644 --- a/handwritten/firestore/cloudbuild.yaml +++ b/handwritten/firestore/cloudbuild.yaml @@ -38,29 +38,6 @@ steps: # - name: 'sa-keys' # path: '/secrets' -# 3. (Optional) Code Coverage Reporting -- name: 'node:24' - entrypoint: 'bash' - args: - - '-c' - - | - # Check if nyc is installed and run report - if [ -f ./node_modules/nyc/bin/nyc.js ]; then - ./node_modules/nyc/bin/nyc.js report || true # `|| true` prevents build failure if nyc report itself exits non-zero - else - echo "nyc not found, skipping coverage report." - fi - # The original codecov.sh script from Kokoro needs to be made available to GCB. - # Options: - # a) Commit codecov.sh into your repo (e.g., .kokoro/codecov.sh) and call it: - # if [ -f .kokoro/codecov.sh ]; then . ./.kokoro/codecov.sh; fi - # b) Replicate its functionality directly in this step. - # c) Store it in a GCS bucket and fetch it. - echo "Codecov reporting (if desired) would be integrated here." - dir: 'handwritten/firestore' - id: 'coverage-report' - waitFor: ['run-system-tests'] - # If you use Secret Manager for credentials, uncomment and configure: # availableSecrets: # secretManager: diff --git a/handwritten/spanner/.kokoro/.gitattributes b/handwritten/spanner/.kokoro/.gitattributes deleted file mode 100644 index 87acd4f484ee..000000000000 --- a/handwritten/spanner/.kokoro/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* linguist-generated=true diff --git a/handwritten/spanner/.kokoro/cleanup.sh b/handwritten/spanner/.kokoro/cleanup.sh deleted file mode 100755 index 53c84cb85ca9..000000000000 --- a/handwritten/spanner/.kokoro/cleanup.sh +++ /dev/null @@ -1,30 +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/node/.npm-global - -# Setup service account credentials. -export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/spanner-key.json -export GCLOUD_PROJECT=long-door-651 - -cd $(dirname $0)/.. - -npm install -g pnpm@9 -pnpm install - -pnpm run cleanup diff --git a/handwritten/spanner/.kokoro/common.cfg b/handwritten/spanner/.kokoro/common.cfg deleted file mode 100644 index 2130504df3f3..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/test.sh" -} diff --git a/handwritten/spanner/.kokoro/continuous/node18/common.cfg b/handwritten/spanner/.kokoro/continuous/node18/common.cfg deleted file mode 100644 index 2130504df3f3..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/test.sh" -} diff --git a/handwritten/spanner/.kokoro/continuous/node18/lint.cfg b/handwritten/spanner/.kokoro/continuous/node18/lint.cfg deleted file mode 100644 index 8aeed86c220a..000000000000 --- a/handwritten/spanner/.kokoro/continuous/node18/lint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-spanner/handwritten/spanner/.kokoro/lint.sh" -} diff --git a/handwritten/spanner/.kokoro/continuous/node18/samples-test.cfg b/handwritten/spanner/.kokoro/continuous/node18/samples-test.cfg deleted file mode 100644 index 3c4bbe887e35..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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/handwritten/spanner/.kokoro/continuous/node18/test.cfg b/handwritten/spanner/.kokoro/continuous/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/spanner/.kokoro/docs.sh b/handwritten/spanner/.kokoro/docs.sh deleted file mode 100755 index 275f81266e38..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/lint.sh b/handwritten/spanner/.kokoro/lint.sh deleted file mode 100755 index d76b839d32d2..000000000000 --- a/handwritten/spanner/.kokoro/lint.sh +++ /dev/null @@ -1,40 +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 -export PATH="${NPM_CONFIG_PREFIX}/bin:${PATH}" - -# Ensure the npm global directory is writable, otherwise rebuild `npm` -mkdir -p ${NPM_CONFIG_PREFIX}/lib -npm config -g ls || npm i -g npm@`npm --version` - -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/handwritten/spanner/.kokoro/populate-secrets.sh b/handwritten/spanner/.kokoro/populate-secrets.sh deleted file mode 100755 index deb2b199eb4c..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/presubmit/node18/common.cfg b/handwritten/spanner/.kokoro/presubmit/node18/common.cfg deleted file mode 100644 index 2130504df3f3..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/test.sh" -} diff --git a/handwritten/spanner/.kokoro/presubmit/node18/samples-test.cfg b/handwritten/spanner/.kokoro/presubmit/node18/samples-test.cfg deleted file mode 100644 index 3c4bbe887e35..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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/handwritten/spanner/.kokoro/presubmit/node18/test.cfg b/handwritten/spanner/.kokoro/presubmit/node18/test.cfg deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/handwritten/spanner/.kokoro/presubmit/windows/common.cfg b/handwritten/spanner/.kokoro/presubmit/windows/common.cfg deleted file mode 100644 index d6e25e0b1b8e..000000000000 --- a/handwritten/spanner/.kokoro/presubmit/windows/common.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - diff --git a/handwritten/spanner/.kokoro/presubmit/windows/test.cfg b/handwritten/spanner/.kokoro/presubmit/windows/test.cfg deleted file mode 100644 index f6f23ee43a11..000000000000 --- a/handwritten/spanner/.kokoro/presubmit/windows/test.cfg +++ /dev/null @@ -1,2 +0,0 @@ -# Use the test file directly -build_file: "nodejs-spanner/handwritten/spanner/.kokoro/test.bat" diff --git a/handwritten/spanner/.kokoro/publish.sh b/handwritten/spanner/.kokoro/publish.sh deleted file mode 100755 index d87a1a6bf00a..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/release/cleanup.cfg b/handwritten/spanner/.kokoro/release/cleanup.cfg deleted file mode 100644 index 2d640508115a..000000000000 --- a/handwritten/spanner/.kokoro/release/cleanup.cfg +++ /dev/null @@ -1,27 +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" - -# Download resources for system tests (service account key, etc.) -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" - -# Use the trampoline script to run in docker. -build_file: "nodejs-spanner/handwritten/spanner/.kokoro/trampoline.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-spanner/handwritten/spanner/.kokoro/cleanup.sh" -} diff --git a/handwritten/spanner/.kokoro/release/common.cfg b/handwritten/spanner/.kokoro/release/common.cfg deleted file mode 100644 index 3ba2eb095fe1..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/release/docs-devsite.cfg b/handwritten/spanner/.kokoro/release/docs-devsite.cfg deleted file mode 100644 index 17cc718c2db9..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-spanner/handwritten/spanner/.kokoro/release/docs-devsite.sh" -} diff --git a/handwritten/spanner/.kokoro/release/docs-devsite.sh b/handwritten/spanner/.kokoro/release/docs-devsite.sh deleted file mode 100755 index 1fe1f4a9fece..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/release/docs.cfg b/handwritten/spanner/.kokoro/release/docs.cfg deleted file mode 100644 index fd6d60eef061..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/trampoline_v2.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/nodejs-spanner/handwritten/spanner/.kokoro/release/docs.sh" -} diff --git a/handwritten/spanner/.kokoro/release/docs.sh b/handwritten/spanner/.kokoro/release/docs.sh deleted file mode 100755 index 2b04cd797cef..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/release/publish.cfg b/handwritten/spanner/.kokoro/release/publish.cfg deleted file mode 100644 index e3e787e4c11e..000000000000 --- a/handwritten/spanner/.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-spanner/handwritten/spanner/.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-spanner/handwritten/spanner/.kokoro/publish.sh" -} - -# Store the packages we uploaded to npmjs.com 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/handwritten/spanner/.kokoro/samples-test.sh b/handwritten/spanner/.kokoro/samples-test.sh deleted file mode 100755 index 2864cbee2508..000000000000 --- a/handwritten/spanner/.kokoro/samples-test.sh +++ /dev/null @@ -1,78 +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 - else - # Check if there are any changes in the "samples" directory only for presubmits. - if git diff --quiet HEAD main -- samples/; then - echo "No changes detected in the samples directory. Skipping sample tests." - exit 0 - fi - 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/handwritten/spanner/.kokoro/test.bat b/handwritten/spanner/.kokoro/test.bat deleted file mode 100644 index caf825656c28..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/test.sh b/handwritten/spanner/.kokoro/test.sh deleted file mode 100755 index ce54eddd8e2d..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/trampoline.sh b/handwritten/spanner/.kokoro/trampoline.sh deleted file mode 100755 index f693a1ce7aa8..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/.kokoro/trampoline_v2.sh b/handwritten/spanner/.kokoro/trampoline_v2.sh deleted file mode 100755 index 104df2dea056..000000000000 --- a/handwritten/spanner/.kokoro/trampoline_v2.sh +++ /dev/null @@ -1,519 +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/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}")/handwritten/spanner" -else - PROJECT_ROOT="$(repo_root $(pwd))/handwritten/spanner" -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="." - - echo "Checking for changes in ${RELATIVE_PKG_PATH}..." - - # Determine the diff range based on the CI system/event - DIFF_RANGE="HEAD~1..HEAD" - - # If we are in a Kokoro Pull Request, diff against the main branch - if [[ -n "${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-}" ]]; then - git fetch origin main --deepen=300 2>/dev/null || true - if git merge-base origin/main HEAD >/dev/null 2>&1; then - DIFF_RANGE="origin/main..." - fi - else - git fetch --deepen=10 2>/dev/null || true - fi - 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/*/}" -TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#handwritten/spanner/}" -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/handwritten/spanner/.trampolinerc b/handwritten/spanner/.trampolinerc deleted file mode 100644 index 5fc2253137db..000000000000 --- a/handwritten/spanner/.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/handwritten/spanner/cloudbuild.yaml b/handwritten/spanner/cloudbuild.yaml index 5ac1335ff111..86f490749444 100644 --- a/handwritten/spanner/cloudbuild.yaml +++ b/handwritten/spanner/cloudbuild.yaml @@ -37,29 +37,6 @@ steps: # - name: 'sa-keys' # path: '/secrets' -# 3. (Optional) Code Coverage Reporting -- name: 'node:24' - entrypoint: 'bash' - args: - - '-c' - - | - # Check if nyc is installed and run report - if [ -f ./node_modules/nyc/bin/nyc.js ]; then - ./node_modules/nyc/bin/nyc.js report || true # `|| true` prevents build failure if nyc report itself exits non-zero - else - echo "nyc not found, skipping coverage report." - fi - # The original codecov.sh script from Kokoro needs to be made available to GCB. - # Options: - # a) Commit codecov.sh into your repo (e.g., .kokoro/codecov.sh) and call it: - # if [ -f .kokoro/codecov.sh ]; then . ./.kokoro/codecov.sh; fi - # b) Replicate its functionality directly in this step. - # c) Store it in a GCS bucket and fetch it. - echo "Codecov reporting (if desired) would be integrated here." - dir: 'handwritten/spanner' - id: 'coverage-report' - waitFor: ['run-system-tests'] - # If you use Secret Manager for credentials, uncomment and configure: # availableSecrets: # secretManager: