Skip to content

Generate Bazel dependency versions from pom.xml#4765

Merged
k8s-ci-robot merged 11 commits into
masterfrom
copilot/sync-library-versions
May 20, 2026
Merged

Generate Bazel dependency versions from pom.xml#4765
k8s-ci-robot merged 11 commits into
masterfrom
copilot/sync-library-versions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

pom.xml and MODULE.bazel had already drifted on shared library versions, which made Maven and Bazel dependency management diverge over time. This change makes the root POM the single source of truth and turns the Bazel dependency block into generated output.

  • Single source of truth

    • Expands root dependencyManagement to cover the Bazel-managed artifacts that were previously versioned only in MODULE.bazel.
    • Keeps shared versions in one place instead of hand-maintaining parallel copies.
  • Generated Bazel dependency block

    • Adds scripts/sync_bazel_dependencies.py to read managed versions from the root pom.xml and rewrite the generated dependency section in MODULE.bazel.
    • Marks the Bazel dependency block as generated so future edits flow through the script instead of manual updates.
  • CI enforcement

    • Adds a Bazel workflow check that fails when MODULE.bazel is stale relative to pom.xml.
    • Includes the generator inputs in the Bazel cache key so dependency changes invalidate correctly.
  • Contributor workflow

    • Documents the expected update path in CONTRIBUTING.md: change versions in pom.xml, regenerate MODULE.bazel, then repin maven_install.json.

Example of the generated pattern in MODULE.bazel:

# BEGIN: generated by scripts/sync_bazel_dependencies.py
maven.install(
    artifacts = [
        "com.fasterxml.jackson.core:jackson-databind:2.21.3",
        "org.slf4j:slf4j-api:2.0.18",
        "org.springframework:spring-core:6.2.8",
    ],
    lock_file = "//:maven_install.json",
)
# END: generated by scripts/sync_bazel_dependencies.py

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 19, 2026
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 19, 2026
@brendandburns
Copy link
Copy Markdown
Contributor

@copilot Rather than hard code all the dependencies in the python script, which has the same syncrhonization problem, please extract them from the pom.xml file when the script runs.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 19, 2026

@copilot Rather than hard code all the dependencies in the python script, which has the same syncrhonization problem, please extract them from the pom.xml file when the script runs.

Addressed in 6e42086. The sync script now derives the generated Bazel dependency list directly from pom.xml dependencyManagement instead of maintaining a hardcoded Python coordinate list.

@brendandburns
Copy link
Copy Markdown
Contributor

@copilot please resolve conflicts

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 19, 2026
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 19, 2026

@copilot please resolve conflicts

Addressed in 155aa92. I merged master, resolved the pom.xml conflict by carrying the AWS SDK version forward to 2.44.8, and regenerated MODULE.bazel from the resolved pom.

@brendandburns
Copy link
Copy Markdown
Contributor

@copilot please make sure that the paths for all of the bazel builds now include the script and the pom.xml file.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot please make sure that the paths for all of the bazel builds now include the script and the pom.xml file.

I checked this: .github/workflows/bazel.yml is the only workflow running Bazel build/test here, and both its push.paths and pull_request.paths already include pom.xml and scripts/sync_bazel_dependencies.py, so no additional change was needed.

@brendandburns
Copy link
Copy Markdown
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 20, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, Copilot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2026
@brendandburns brendandburns marked this pull request as ready for review May 20, 2026 01:41
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2026
@k8s-ci-robot k8s-ci-robot merged commit 4532b2d into master May 20, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants