Skip to content

test: run the bigtable system tests in google cloud build#8192

Merged
gcf-merge-on-green[bot] merged 44 commits into
mainfrom
migrate-bigtable-to-gcp-cloud-build
May 12, 2026
Merged

test: run the bigtable system tests in google cloud build#8192
gcf-merge-on-green[bot] merged 44 commits into
mainfrom
migrate-bigtable-to-gcp-cloud-build

Conversation

@danieljbruce
Copy link
Copy Markdown
Contributor

@danieljbruce danieljbruce commented May 6, 2026

Description

This pull request adds a yaml file to instruct the Bigtable system test CI check to work with the new Cloud Build trigger thereby making the new CI check effectively run our system tests. It also includes minor code modifications to the Bigtable handwritten layer that allow the system tests to operate properly in the new Cloud Build Environment.

Impact

Leverages the strengths of running system tests in GCB rather than relying on kokoro for system tests.

Testing

This pull request tells the tests how to work with the new check to the continuous integration pipeline for the Bigtable system tests thus improves the effectiveness of that test.

image

Next Steps

  1. Merge a pull request that removes the system tests from kokoro. This should be done in a separate pull request to separate the concerns of removing the kokoro system tests from adding the Google Cloud Build system tests.
  2. Distribute a document detailing the process for migrating system tests from kokoro to GCB for all handwritten libraries.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates system tests from Kokoro to Google Cloud Build for the handwritten/bigtable project. The existing Kokoro script is replaced with a notification, and a new cloudbuild.yaml is introduced. Feedback focuses on correcting the Cloud Build configuration, specifically addressing issues with environment variable persistence across steps, incorrect working directory paths, and the execution order of pre-test hooks. Consolidating steps and ensuring the correct directory context is used will prevent build failures and maintain coverage reporting.

I am having trouble creating individual review comments. Click here to see my feedback.

handwritten/bigtable/cloudbuild.yaml (6-55)

high

The current multi-step configuration has several issues that will likely cause the build to fail or behave incorrectly:

  1. Environment Variable Persistence: Each Cloud Build step runs in a separate container. Environment variables exported by .kokoro/pre-system-test.sh in Step 2 will not be available to Step 3.
  2. Working Directory: Cloud Build's default working directory is the repository root. Since this project is located in handwritten/bigtable, you must specify dir: 'handwritten/bigtable' for the steps to find package.json and the .kokoro directory. The current dir: '.' refers to the repo root, not the directory containing the cloudbuild.yaml file.
  3. Execution Order: The original Kokoro script ran the pre-test hook before npm install. This is important if the hook configures registry credentials or environment-specific settings needed for installation.
  4. Efficiency: npm install -g npm@latest and global prefix configuration are generally unnecessary in the Cloud Build environment and add overhead.

Consolidating these into a single step with the correct dir and execution order ensures correctness and improves performance.

- name: 'gcr.io/cloud-builders/npm'
  id: 'run-system-tests'
  entrypoint: 'bash'
  dir: 'handwritten/bigtable'
  args:
  - '-c'
  - |
    if [ -f .kokoro/pre-system-test.sh ]; then
      echo "Running pre-system-test.sh..."
      . .kokoro/pre-system-test.sh
    fi
    npm install
    npm run system-test
  env:
  - 'GCLOUD_PROJECT=${_GCP_PROJECT_ID}'

handwritten/bigtable/cloudbuild.yaml (58-77)

medium

This step also requires the correct working directory (dir: 'handwritten/bigtable') to find the coverage artifacts. Additionally, the original Kokoro script uploaded coverage via codecov.sh, which is currently missing here. Consider adding the logic to upload reports to Codecov to avoid a regression in coverage tracking.

- name: 'gcr.io/cloud-builders/npm'
  id: 'coverage-report'
  entrypoint: 'bash'
  dir: 'handwritten/bigtable'
  args:
  - '-c'
  - |
    if [ -f ./node_modules/nyc/bin/nyc.js ]; then
      ./node_modules/nyc/bin/nyc.js report || true
    else
      echo "nyc not found, skipping coverage report."
    fi
    # TODO: Implement codecov upload logic here.
    echo "Codecov reporting (if desired) would be integrated here."

@danieljbruce danieljbruce changed the title Migrate bigtable to gcp cloud build feat: add new Bigtable feature May 6, 2026
@danieljbruce danieljbruce marked this pull request as ready for review May 6, 2026 17:50
danieljbruce and others added 22 commits May 6, 2026 13:50
@danieljbruce danieljbruce changed the title feat: add new Bigtable feature test: move the system tests over from kokoro to google cloud build May 8, 2026
@danieljbruce danieljbruce changed the title test: move the system tests over from kokoro to google cloud build test: run the bigtable system tests in google cloud build May 8, 2026
@danieljbruce
Copy link
Copy Markdown
Contributor Author

The current multi-step configuration has several issues that will likely cause the build to fail or behave incorrectly:

  1. Environment Variable Persistence: Each Cloud Build step runs in a separate container. Environment variables exported by .kokoro/pre-system-test.sh in Step 2 will not be available to Step 3.

This won't be an issue since the pre-system-test is just an npm run compile.

  1. Working Directory: Cloud Build's default working directory is the repository root. Since this project is located in handwritten/bigtable, you must specify dir: 'handwritten/bigtable' for the steps to find package.json and the .kokoro directory. The current dir: '.' refers to the repo root, not the directory containing the cloudbuild.yaml file.

I think dir: 'handwritten/bigtable' is specified now.

  1. Execution Order: The original Kokoro script ran the pre-test hook before npm install. This is important if the hook configures registry credentials or environment-specific settings needed for installation.

The presystem-test script, which runs npm run compile is a no-op because the npm install script compiles the typescript anyways. I think the original script did things in the wrong order since it doesn't make sense to compile if the modules are not installed yet.

  1. Efficiency: npm install -g npm@latest and global prefix configuration are generally unnecessary in the Cloud Build environment and add overhead.

This is a good point. Not so much for efficiency as I don't think that will matter much, but we should pin the node version to 18 to get consistent results.

Comment thread handwritten/bigtable/system-test/install.ts Outdated
Comment thread handwritten/bigtable/cloudbuild.yaml Outdated
args:
- '-c'
- |
if [ -f /workspace/skip_tests ]; then exit 0; fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not just terminate the workflow early? Do we have to guard every step? I am not sure how to do this, but I suspect this has to be a built in feature?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist implement this suggestion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Google Cloud Build, there is no native 'early exit' or 'skip all' command that can terminate the entire build pipeline from a single step. The approach of using a sentinel file (like /workspace/skip_tests) to guard subsequent steps is the standard, idiomatic way to implement conditional execution in GCB. While it requires a check in each step, it ensures that the build pipeline remains predictable and that each step can explicitly decide whether to run or exit gracefully.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll go with gemini's suggestion on this one. I actually tried to remove this step a day ago, but gemini cli combined all these configs into one config which I didn't want so I abandoned this change. I guess it did it because the configs don't support an early exit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we can remove this now that we removed the first step and we are not writing to workspace/skip_tests anymore.

Comment thread handwritten/bigtable/cloudbuild.yaml Outdated
Comment thread handwritten/bigtable/cloudbuild.yaml Outdated
- |
if [ -f /workspace/skip_tests ]; then exit 0; fi
npm install
npm run presystem-test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may get executed twice. I think NPM will automatically execute the pre* commands on run? Can you verify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's true. It does so I think we can remove this.

Comment thread handwritten/bigtable/cloudbuild.yaml Outdated
else
echo "Changes detected in handwritten/bigtable. Proceeding with tests."
fi
dir: 'handwritten/bigtable'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this step at all since GCB can configure when to run based on change detection? When this config enabled it should only run if there are changes in this directory in the first place, right?

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. In which case, I think we can also remove waitFor: ['check-changes'] which was added earlier because of this step

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this modifying a generated asset? Does this proto.js get made by the generator? If so, does it risk getting overwritten in the future? Would the library break if this happened?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. tabular-api-surface.ts is entirely handwritten.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I meant "protos.js", not this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protos.js diff has been eliminated by merging with main.

@danieljbruce danieljbruce requested a review from pearigee May 12, 2026 19:19
@danieljbruce danieljbruce added the automerge Merge the pull request once unit tests and other checks pass. label May 12, 2026
@gcf-merge-on-green gcf-merge-on-green Bot merged commit 24afc64 into main May 12, 2026
31 checks passed
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label May 12, 2026
@gcf-merge-on-green gcf-merge-on-green Bot deleted the migrate-bigtable-to-gcp-cloud-build branch May 12, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants