Skip to content

Conversation

@Abacn
Copy link
Contributor

@Abacn Abacn commented Jan 28, 2026

Part of #2279

@Abacn Abacn added the improvement Making existing code better label Jan 28, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @Abacn, 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 implements a crucial enhancement for Dataflow YAML templates, enabling them to share a common container image. This is achieved by introducing a dynamic mechanism for the Python launcher to identify and load the appropriate YAML definition at runtime, supported by a centralized system for managing container-specific resources and an index file within the container. The change streamlines the deployment process and improves efficiency for YAML-based pipelines.

Highlights

  • Shared Container Image for YAML Templates: Multiple YAML-based Dataflow templates can now share a single container image, reducing build and deployment overhead by centralizing common resources.
  • Dynamic YAML Template Selection: The Python launcher for YAML templates has been updated to dynamically select the correct YAML definition file at runtime based on pipeline labels, rather than relying on a fixed 'template.yaml' file.
  • Centralized Container Resource Management: A new ContainerStageTracker class manages the files and metadata associated with shared container images, including compatibility checks for templates sharing the same container.
  • Automated YAML Index Generation: A yaml-templates-index JSON file is now generated and included in shared container images, mapping template names to their respective YAML definition files for dynamic lookup.
  • Refactored YAML Template Staging Logic: The Maven plugin's logic for preparing and staging YAML template files and Dockerfiles has been significantly refactored to support the new shared container model and dynamic file inclusion.
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 53.08642% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.92%. Comparing base (ba21420) to head (facf696).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...loud/teleport/plugin/maven/TemplatesStageMojo.java 53.08% 29 Missing and 9 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3268      +/-   ##
============================================
- Coverage     50.94%   50.92%   -0.02%     
- Complexity     5159     5546     +387     
============================================
  Files           977      979       +2     
  Lines         60405    60553     +148     
  Branches       6608     6634      +26     
============================================
+ Hits          30772    30837      +65     
- Misses        27479    27547      +68     
- Partials       2154     2169      +15     
Components Coverage Δ
spanner-templates 70.83% <ø> (-0.20%) ⬇️
spanner-import-export 68.91% <ø> (-0.15%) ⬇️
spanner-live-forward-migration 80.04% <ø> (-0.08%) ⬇️
spanner-live-reverse-replication 77.58% <ø> (-0.15%) ⬇️
spanner-bulk-migration 88.08% <ø> (-0.38%) ⬇️
Files with missing lines Coverage Δ
...gle/cloud/teleport/plugin/DockerfileGenerator.java 90.00% <ø> (ø)
...loud/teleport/plugin/maven/TemplatesStageMojo.java 17.87% <53.08%> (+4.74%) ⬆️

... and 16 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 force-pushed the parallel-yaml branch 5 times, most recently from a8c7f60 to a857c68 Compare January 28, 2026 22:50
@Abacn Abacn changed the title [WIP] Yaml templates sharing container image Yaml templates sharing container image Jan 29, 2026
@Abacn Abacn marked this pull request as ready for review January 29, 2026 19:44
@Abacn
Copy link
Contributor Author

Abacn commented Jan 29, 2026

R: @derrickaw

derrickaw
derrickaw previously approved these changes Jan 29, 2026
@Abacn
Copy link
Contributor Author

Abacn commented Jan 30, 2026

The latest commit fixed an edge case preventing container compatibility check working when a compatible template came first then an incompatible one reuse container (not happening in current Templates).

KafkaToIceberg Yaml test failed with managed transform launcher fail, a combination of b/479594634 (serverless launcher failing) and stock out of the region (GCE launcher cannot be provisioned) caused the issue, not related to this change

Dataflow is unable to process the managed transform(s) ref_AppliedPTransform_WriteToIceberg-SchemaAwareExternalTransform-beam-transform-managed-v1_6(beam:schematransform:org.apache.beam:iceberg_write:v1),ref_AppliedPTransform_ReadFromKafka-beam-schematransform-org-apache-beam-kafka_read-v1_3(beam:schematransform:org.apache.beam:kafka_read:v1) due to an internal error. Because the upgrade failed, the new job or the update request has been rejected. To troubleshoot, see https://cloud.google.com/dataflow/docs/guides/common-errors#managed-transforms-upgrade.
2026-01-29 20:47:08.047 EST
Unknown error in operation 'operation-1769737619256-6499126243540-62553c5b-cc61bf89': [ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS] 'The zone 'projects/cloud-teleport-testing/zones/us-west2-b' does not have enough resources available to fulfill the request.  '(resource type:compute)'.'

update: second attempt failed one test, same reason:

Unknown error in operation 'operation-1769804533087-649a0ba843b9c-cc99d86b-07e149cc': [ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS] 'The zone 'projects/cloud-teleport-testing/zones/us-west2-b' does not have enough resources available to fulfill the request. 

@Abacn Abacn merged commit 5ef96bd into GoogleCloudPlatform:main Jan 30, 2026
27 of 29 checks passed
@Abacn Abacn deleted the parallel-yaml branch January 30, 2026 22:01
@Abacn
Copy link
Contributor Author

Abacn commented Jan 31, 2026

It appears this PR triggered a weird bug of template parameter corruption: https://github.com/GoogleCloudPlatform/DataflowTemplates/actions/runs/21535675203

"details": [
    {
      "@type": "type.googleapis.com/google.dataflow.v1beta3.InvalidTemplateParameters",
      "parameterViolations": [
        {
          "description": "Conditional parameter had an invalid trigger value: 'AVRO_BINARY_ENCODING'",
          "parameter": "schemaFormat"
        }
      ]
    }
  ],

checking the template json, this PR caused json fields ordered alphabetically.

Previously

{
        "name": "readBootstrapServerAndTopic",
        "groupName": "Source",
        "label": "Source Kafka Topic",
        "helpText": "Kafka Topic to read the input from.",
        "parentTriggerValues": [
          ""
        ],
        "paramType": "KAFKA_READ_TOPIC"
      },

now

{
                "groupName": "Source",
                "helpText": "Kafka Topic to read the input from.",
                "label": "Source Kafka Topic",
                "name": "readBootstrapServerAndTopic",
                "paramType": "KAFKA_READ_TOPIC",
                "parentTriggerValues": [
                    ""
                ]
            },

This is due to a line added during debugging forgot to remove: https://github.com/GoogleCloudPlatform/DataflowTemplates/pull/3268/changes#diff-e974a7cb17b5eaece9f4bf8e4c0952d47a5de1313b51a8ac51fe0e872c3240f9R598

causing template spec file not overriden (and latter steps, e.g. SBOM/scanning skipped. Though there were not enabled in test run either)

This should still work as templates is built via gcloud dataflow flex-template build command as we are not actively changing template request proto recently. However it generates a invalid json seen by router. We should revisit it afterwards.

EDIT: reverting this PR the test failure persists: go/templates-pr/3286

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

Labels

improvement Making existing code better size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants