Skip to content

Test pre-staged release templates in release.yml instead of rebuilding - #4625

Merged
shunping merged 2 commits into
GoogleCloudPlatform:mainfrom
Abacn:test-prestaged-release-templates
Nov 24, 2026
Merged

shunping merged 2 commits into
GoogleCloudPlatform:mainfrom
Abacn:test-prestaged-release-templates

Conversation

@Abacn

@Abacn Abacn commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Add support for resolving pre-staged release template specs via -DspecPathPrefix (and --it-spec-path-prefix in cicd runners) so the release workflow tests the staged release artifacts at gs://// instead of rebuilding and re-staging templates from source during integration tests.

  • Add TemplateTestBase.getPreStagedSpecPath() supporting Classic (/) and Flex/Python/YAML (/flex/) layouts without registering pre-staged specs in the cleanup cache.

  • Wire -DspecPathPrefix in TemplateTestBase, TemplateLoadTestBase, and FlexTemplateDataflowJobResourceManager (still staging locally when an additionalMavenProfile is set).

  • Add --it-spec-path-prefix flag in cicd/internal/flags and pass it in run-it-tests and run-it-smoke-tests.

  • Add stageBucket input (defaulting to dataflow-templates-staging) to .github/workflows/release.yml and pass --it-spec-path-prefix to all release integration test steps.

Add support for resolving pre-staged release template specs via
-DspecPathPrefix (and --it-spec-path-prefix in cicd runners) so the
release workflow tests the staged release artifacts at
gs://<stageBucket>/<candidateName>/ instead of rebuilding and re-staging
templates from source during integration tests.

- Add TemplateTestBase.getPreStagedSpecPath() supporting Classic
  (<prefix>/<name>) and Flex/Python/YAML (<prefix>/flex/<name>) layouts
  without registering pre-staged specs in the cleanup cache.
- Wire -DspecPathPrefix in TemplateTestBase, TemplateLoadTestBase, and
  FlexTemplateDataflowJobResourceManager (still staging locally when an
  additionalMavenProfile is set).
- Add --it-spec-path-prefix flag in cicd/internal/flags and pass it in
  run-it-tests and run-it-smoke-tests.
- Add stageBucket input (defaulting to dataflow-templates-staging) to
  .github/workflows/release.yml and pass --it-spec-path-prefix to all
  release integration test steps.
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.72%. Comparing base (49529d9) to head (13f8d68).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
.../java/org/apache/beam/it/gcp/TemplateTestBase.java 0.00% 21 Missing ⚠️
...taflow/FlexTemplateDataflowJobResourceManager.java 0.00% 12 Missing ⚠️
...a/org/apache/beam/it/gcp/TemplateLoadTestBase.java 0.00% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #4625       +/-   ##
=============================================
+ Coverage     33.53%   59.72%   +26.18%     
- Complexity      512     8383     +7871     
=============================================
  Files           219     1123      +904     
  Lines         13486    72735    +59249     
  Branches       1373     8852     +7479     
=============================================
+ Hits           4523    43442    +38919     
- Misses         8590    26393    +17803     
- Partials        373     2900     +2527     
Components Coverage Δ
spanner-templates 84.03% <ø> (∅)
spanner-import-export 72.72% <ø> (∅)
spanner-live-forward-migration 87.65% <ø> (∅)
spanner-live-reverse-replication 79.94% <ø> (∅)
spanner-bulk-migration 88.29% <ø> (∅)
gcs-spanner-dv 86.58% <ø> (∅)
Files with missing lines Coverage Δ
...a/org/apache/beam/it/gcp/TemplateLoadTestBase.java 0.00% <0.00%> (ø)
...taflow/FlexTemplateDataflowJobResourceManager.java 22.12% <0.00%> (-1.25%) ⬇️
.../java/org/apache/beam/it/gcp/TemplateTestBase.java 0.00% <0.00%> (ø)

... and 929 files with indirect coverage changes

🚀 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.

@Abacn
Abacn marked this pull request as ready for review November 23, 2026 21:24
@Abacn
Abacn requested a review from a team as a code owner November 23, 2026 21:24
@Abacn
Abacn requested a review from shunping November 23, 2026 21:24
@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 a mechanism to use pre-staged Dataflow template specifications during integration tests. By allowing tests to point to a GCS prefix containing pre-built templates, the system avoids redundant and time-consuming rebuilds of templates from source code. This change improves CI/CD efficiency by enabling the testing of release candidates directly from their staged locations.

Highlights

  • Pre-staged Template Support: Added support for resolving pre-staged release template specs via a new -DspecPathPrefix property, allowing integration tests to use existing artifacts instead of rebuilding them from source.
  • CI/CD Integration: Updated CI/CD test runners and release workflows to accept an --it-spec-path-prefix flag, enabling the use of staged release artifacts in automated testing pipelines.
  • Resource Management: Refactored TemplateTestBase and FlexTemplateDataflowJobResourceManager to prioritize pre-staged paths when provided, while maintaining local staging fallback for specific build profiles.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/release.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 a new specPathPrefix configuration flag to integration tests, allowing them to use pre-staged templates from a GCS prefix instead of building and staging them from source. Changes span Go CLI flags, Java test base classes, and resource managers, along with corresponding unit tests. The review feedback highlights a critical issue in the newly added unit tests (TemplateTestBaseTest and FlexTemplateDataflowJobResourceManagerTest), where system properties are cleared during teardown without restoring their original values, potentially causing test pollution in the shared JVM.

@shunping shunping 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.

LGTM, thanks!

@shunping
shunping merged commit ecc1ae3 into GoogleCloudPlatform:main Nov 24, 2026
49 of 50 checks passed
@Abacn
Abacn deleted the test-prestaged-release-templates branch November 24, 2026 21:56
@claudevdm

Copy link
Copy Markdown
Contributor

@Abacn the first Release run since this merged failed in "Run Integration Tests With DEFAULT": https://github.com/GoogleCloudPlatform/DataflowTemplates/actions/runs/46475491825

The only failing test was BigQueryToDatastoreIT.testBigQueryToDatastore, which failed on all three attempts. Each Dataflow job failed with the same error from the BigQuery export:

Access Denied: BigQuery BigQuery: Permission denied while writing data. 269744978479-compute@developer.gserviceaccount.com does not have storage.objects.create access to the Google Cloud Storage object. Permission 'storage.objects.create' denied on resource '//storage.googleapis.com/projects/_/buckets/dataflow-staging-us-central1-473832897378/objects/temp/BigQueryExtractTemp/1cdc5166dc2d4f2d8b51342385d9d9e0/000000000000.avro' (or it may not exist).

What seems to be happening:

  • The pre-staged template gs://dataflow-templates-staging/2026-11-30-00_RC00/Cloud_BigQuery_to_Cloud_Datastore has tempLocation=gs://dataflow-staging-us-central1-473832897378/temp/ baked into its pipeline options. That bucket is in the dataflow-templates project.
  • The test launches it in cloud-teleport-testing with an empty environment, so the job keeps that tempLocation, and the test project's worker service account can't write there.
  • Other pre-staged classic templates carry the same tempLocation (I checked Cloud_BigQuery_to_GCS_TensorFlow_Records, whose test passed). This one breaks because it reads BigQuery with the default export method, which writes extract files to tempLocation; BigQueryToTFRecord uses DIRECT_READ.

A rerun will hit the same error. Some options (untested):

  1. Set a tempLocation in the test project when launching pre-staged classic templates, if a launch-time value overrides the baked-in one.
  2. Grant the test project's worker service account write access to the staging temp bucket.
  3. Keep staging this template from source in the release tests until one of the above is in place.

Example failed job: https://console.cloud.google.com/dataflow/jobs/us-west2/2026-11-30_11_26_20-5464299733782828715?project=cloud-teleport-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants