Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions handwritten/bigtable/.kokoro/system-test.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions handwritten/bigtable/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# cloudbuild.yaml
# Placed inside handwritten/bigtable/

steps:
# 1. Set up Node.js environment
- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'bash'
args:
- '-c'
- |
npm install -g npm@latest
npm config set prefix /usr/local
npm install
dir: 'handwritten/bigtable' # Changed to '.' as the cloudbuild.yaml is in this directory
id: 'install-dependencies'

# 2. (Optional) Run pre-system-test.sh if it exists
- name: 'ubuntu'
entrypoint: 'bash'
args:
- '-c'
- |
if [ -f .kokoro/pre-system-test.sh ]; then
echo "Running pre-system-test.sh..."
# Make sure to source it correctly relative to the current dir
. ./.kokoro/pre-system-test.sh
else
echo "No .kokoro/pre-system-test.sh found, skipping."
fi
dir: 'handwritten/bigtable'
id: 'run-pre-test-hook'

# 3. Configure environment variables for the tests and run system tests
# - GOOGLE_APPLICATION_CREDENTIALS: GCB steps run as a service account
# that is typically granted permissions directly. Explicitly setting
# GOOGLE_APPLICATION_CREDENTIALS might not be needed if the GCB service
# account has the right roles (e.g., Bigtable Admin, Bigtable User).
# If you need to use specific service account key JSON, you'd store it
# in Secret Manager and mount it here. For simplicity, we'll rely on
# the GCB service account's inherent permissions.
# - GCLOUD_PROJECT: Can be passed as a build variable.
- name: 'gcr.io/cloud-builders/npm'
entrypoint: 'npm'
args: ['run', 'system-test']
dir: 'handwritten/bigtable'
env:
- 'GCLOUD_PROJECT=${_GCP_PROJECT_ID}' # Pass project ID via build variable
# If you need specific credentials from Secret Manager, uncomment these:
# - 'GOOGLE_APPLICATION_CREDENTIALS=/secrets/sa-key.json'
id: 'run-system-tests'
# For Secret Manager, uncomment these (adjust secret name and volume path as needed):
# secretEnv: ['SA_KEY']
# volumes:
# - name: 'sa-keys'
# path: '/secrets'

# 4. (Optional) Code Coverage Reporting
- name: 'gcr.io/cloud-builders/npm'
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' # Changed to '.'
id: 'coverage-report'

# If you use Secret Manager for credentials, uncomment and configure:
# availableSecrets:
# secretManager:
# - versionName: projects/${PROJECT_ID}/secrets/YOUR_SERVICE_ACCOUNT_KEY_SECRET_NAME/versions/latest
# env: 'SA_KEY' # This env var will hold the secret value. Use it as GOOGLE_APPLICATION_CREDENTIALS in step 3 if needed.

# Define a substitution variable for your project ID
# Replace 'long-door-651' with the actual GCP Project ID your system tests should run against.
substitutions:
_GCP_PROJECT_ID: 'long-door-651'
Loading
Loading