Skip to content

Enable direct runner for github actions for spanner templates - #4252

Open
dhwanilpatel wants to merge 19 commits into
GoogleCloudPlatform:mainfrom
dhwanilpatel:directrunner_poc
Open

dhwanilpatel wants to merge 19 commits into
GoogleCloudPlatform:mainfrom
dhwanilpatel:directrunner_poc

Conversation

@dhwanilpatel

Copy link
Copy Markdown
Contributor

This PR enables directrunner for github actions for Spanner Migration templates.

NOTE: DO NOT REVIEW THE PR AS IT IS IN PROGRESS.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces support for the DirectRunner in Spanner migration templates, enabling local execution of integration tests. The changes include updates to CI/CD tooling to toggle the runner type, adjustments to template logic to accommodate local execution environments, and modifications to existing integration tests to correctly handle resource staging and pathing.

Highlights

  • DirectRunner Support: Added infrastructure to support DirectRunner in integration tests, allowing tests to run locally instead of exclusively on Dataflow.
  • Template Adjustments: Updated Spanner migration templates to bypass machine specification validation when running with DirectRunner.
  • Test Configuration: Modified integration tests to handle local file paths and conditional staging of extra files when using the DirectRunner.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/spanner-pr.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

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

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.

Code Review

This pull request introduces support for running integration tests using the DirectRunner instead of the DataflowRunner. It adds a new CLI flag -it-direct-runner to the CI/CD test runner, bypasses Dataflow machine spec validation when DirectRunner is used, and adjusts the integration tests to conditionally configure local truststore paths and skip staging extra files. The reviewer feedback suggests a more robust way to check the directRunnerTest system property in Java by using Boolean.getBoolean("directRunnerTest") instead of checking for null/non-null values, which could fail if the property is explicitly set to "false".

Comment on lines +150 to +152
if (System.getProperty("directRunnerTest") == null) {
jobParameters.put("extraFilesToStage", truststoreGcsPath);
}

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.

medium

Checking System.getProperty("directRunnerTest") == null is fragile because if the property is explicitly set to "false" (e.g., -DdirectRunnerTest=false), the check will still evaluate as if it is enabled. Using Boolean.getBoolean("directRunnerTest") is much more robust and idiomatic in Java, as it safely parses the property value and returns true only if it is explicitly set to "true".

Suggested change
if (System.getProperty("directRunnerTest") == null) {
jobParameters.put("extraFilesToStage", truststoreGcsPath);
}
if (!Boolean.getBoolean("directRunnerTest")) {
jobParameters.put("extraFilesToStage", truststoreGcsPath);
}

Comment on lines +2386 to +2388
if (System.getProperty("directRunnerTest") != null) {
truststorePath = cassandraResourceManager.getTrustStoreFile().getAbsolutePath();
}

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.

medium

Checking System.getProperty("directRunnerTest") != null is fragile because if the property is explicitly set to "false" (e.g., -DdirectRunnerTest=false), the check will still evaluate as if it is enabled. Using Boolean.getBoolean("directRunnerTest") is much more robust and idiomatic in Java, as it safely parses the property value and returns true only if it is explicitly set to "true".

Suggested change
if (System.getProperty("directRunnerTest") != null) {
truststorePath = cassandraResourceManager.getTrustStoreFile().getAbsolutePath();
}
if (Boolean.getBoolean("directRunnerTest")) {
truststorePath = cassandraResourceManager.getTrustStoreFile().getAbsolutePath();
}

Comment on lines +122 to +124
if (System.getProperty("directRunnerTest") != null) {
truststoreLocalUrl = "file://" + jdbcResourceManager.getTruststorePath();
}

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.

medium

Checking System.getProperty("directRunnerTest") != null is fragile because if the property is explicitly set to "false" (e.g., -DdirectRunnerTest=false), the check will still evaluate as if it is enabled. Using Boolean.getBoolean("directRunnerTest") is much more robust and idiomatic in Java, as it safely parses the property value and returns true only if it is explicitly set to "true".

Suggested change
if (System.getProperty("directRunnerTest") != null) {
truststoreLocalUrl = "file://" + jdbcResourceManager.getTruststorePath();
}
if (Boolean.getBoolean("directRunnerTest")) {
truststoreLocalUrl = "file://" + jdbcResourceManager.getTruststorePath();
}

Comment on lines +157 to +159
if (System.getProperty("directRunnerTest") == null) {
jobParameters.put("extraFilesToStage", truststoreGcsUrl);
}

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.

medium

Checking System.getProperty("directRunnerTest") == null is fragile because if the property is explicitly set to "false" (e.g., -DdirectRunnerTest=false), the check will still evaluate as if it is enabled. Using Boolean.getBoolean("directRunnerTest") is much more robust and idiomatic in Java, as it safely parses the property value and returns true only if it is explicitly set to "true".

Suggested change
if (System.getProperty("directRunnerTest") == null) {
jobParameters.put("extraFilesToStage", truststoreGcsUrl);
}
if (!Boolean.getBoolean("directRunnerTest")) {
jobParameters.put("extraFilesToStage", truststoreGcsUrl);
}

@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 9.09091% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.33%. Comparing base (0351342) to head (3f94517).

Files with missing lines Patch % Lines
...oud/teleport/v2/templates/DataStreamToSpanner.java 0.00% 2 Missing and 1 partial ⚠️
...cloud/teleport/v2/templates/SourceDbToSpanner.java 0.00% 2 Missing and 1 partial ⚠️
...cloud/teleport/v2/templates/SpannerToSourceDb.java 0.00% 3 Missing ⚠️
...pache/beam/it/gcp/dataflow/DirectRunnerClient.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4252      +/-   ##
============================================
- Coverage     56.33%   56.33%   -0.01%     
  Complexity     7854     7854              
============================================
  Files          1155     1155              
  Lines         73226    73233       +7     
  Branches       8585     8588       +3     
============================================
- Hits          41254    41253       -1     
- Misses        29186    29192       +6     
- Partials       2786     2788       +2     
Components Coverage Δ
spanner-templates 84.42% <10.00%> (-0.04%) ⬇️
spanner-import-export 69.03% <ø> (ø)
spanner-live-forward-migration 88.86% <0.00%> (-0.05%) ⬇️
spanner-live-reverse-replication 80.80% <25.00%> (-0.02%) ⬇️
spanner-bulk-migration 88.94% <0.00%> (-0.03%) ⬇️
gcs-spanner-dv 88.02% <ø> (ø)
Files with missing lines Coverage Δ
...leport/v2/templates/transforms/SourceWriterFn.java 76.68% <100.00%> (+0.14%) ⬆️
...pache/beam/it/gcp/dataflow/DirectRunnerClient.java 0.00% <0.00%> (ø)
...oud/teleport/v2/templates/DataStreamToSpanner.java 87.19% <0.00%> (-0.96%) ⬇️
...cloud/teleport/v2/templates/SourceDbToSpanner.java 75.60% <0.00%> (-6.45%) ⬇️
...cloud/teleport/v2/templates/SpannerToSourceDb.java 8.51% <0.00%> (-0.07%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pull-request-size pull-request-size Bot added size/M and removed size/L labels Sep 18, 2026
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant