Skip to content

ci: remove redundant setup-java and Maven 3.8.2 downgrade from unmanaged-dependency-check - #15445

Merged
lqiu96 merged 2 commits into
googleapis:mainfrom
lqiu96:ci/fix-unmanaged-dependency-check
Dec 4, 2026
Merged

lqiu96 merged 2 commits into
googleapis:mainfrom
lqiu96:ci/fix-unmanaged-dependency-check

Conversation

@lqiu96

@lqiu96 lqiu96 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Remove actions/setup-java@v3 and stCarolas/setup-maven@v4.5 (Maven 3.8.2) from unmanaged-dependency-check/action.yaml so the action uses the caller's JDK, Maven settings.xml, and preinstalled Maven 3.10.x instead of downgrading after Maven 3.10.x has already hard-linked installed POMs into ~/.m2/repository. Also pass inputs.bom-path via an environment variable and print captured Maven output on failure with -e.

Try to resolve this CI failure: https://github.com/googleapis/google-cloud-java/actions/runs/46971080890/job/144626791721?pr=15150

Job looks to pass after this change: https://github.com/googleapis/google-cloud-java/actions/runs/47391343513/job/145245991347?pr=15445

…ged-dependency-check

Remove actions/setup-java@v3 and stCarolas/setup-maven@v4.5 (Maven 3.8.2) from unmanaged-dependency-check/action.yaml so the action uses the caller's JDK, Maven settings.xml, and preinstalled Maven 3.10.x instead of downgrading after Maven 3.10.x has already hard-linked installed POMs into ~/.m2/repository. Also pass inputs.bom-path via an environment variable and print captured Maven output on failure with -e.

@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 refactors the GitHub Action for checking unmanaged dependencies by removing the explicit Java and Maven setup steps, using the GITHUB_ACTION_PATH environment variable, and passing the BOM path input via an environment variable. It also adds error handling to the Maven execution step. Feedback on the changes suggests using printf instead of echo to print the output of the dependency check to prevent potential issues with leading hyphens.

echo "Running Unmanaged Dependency Check against ${bom_absolute_path}"
unmanaged_dependencies=$(mvn exec:java -Dexec.args="../pom.xml ${bom_absolute_path}" -q)
if ! unmanaged_dependencies=$(mvn exec:java -Dexec.args="../pom.xml ${bom_absolute_path}" -q -e); then
echo "${unmanaged_dependencies}"

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

Using echo to print arbitrary command output can lead to unexpected behavior if the output starts with a hyphen (e.g., -n or -e), as echo will interpret it as an option. It is safer and more robust to use printf instead.

          printf "%s\n" "${unmanaged_dependencies}"

@lqiu96
lqiu96 requested a review from jinseopkim0 December 4, 2026 17:49
@lqiu96
lqiu96 marked this pull request as ready for review December 4, 2026 17:49
@lqiu96
lqiu96 requested a review from a team as a code owner December 4, 2026 17:49
@lqiu96
lqiu96 merged commit d683d5d into googleapis:main Dec 4, 2026
205 of 206 checks passed
lqiu96 added a commit that referenced this pull request Dec 4, 2026
…3.0) across workflows (#15447)

Standardizes `actions/checkout` and `actions/setup-java` versions across
GitHub Actions workflows and
`java-cloud-bom/tests/validate-bom/action.yml`.

### Changes
- Updates 104 `actions/checkout` references (previously split across
`v3.6.0` through `v6.1.0`) to `3d3c42e5aac5ba805825da76410c181273ba90b1`
(`v7.0.1`).
- Updates 100 `actions/setup-java` references (previously split across
`v3.14.1` through `v5.7.0`) to
`d1374f8ac74474200d16ef8ecee22c7ae7a51880` (`v6.3.0`).
- Excludes `librarian_generation_check.yaml`,
`update_librarian_googleapis.yaml`, the 7 Spanner CI workflows, and
`sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check/action.yaml`
(updated separately in #15445).

### Why
- Removes deprecated action versions and runtimes:
`actions/checkout@v3.6.0` and `actions/setup-java@v3.14.1` target
deprecated Node 16 (`setup-java@v3` is EOL and logs deprecation warnings
on every run), and `actions/checkout@v4.x` / `actions/setup-java@v4.x`
target Node 20 (which GitHub Actions runners warn is deprecated and
force onto Node 24). Both `v7.0.1` and `v6.3.0` run natively on Node 24.
- Unifies Maven cache keys: `setup-java@v3`
(`setup-java-Linux-maven-<hash>`) and `v4`/`v5`
(`setup-java-Linux-x64-maven-<hash>`) produced separate cache entries
under the 10 GB repository cache cap, causing avoidable cache misses and
evictions across workflows.
- Picks up `actions/setup-java` v6.x improvements relevant to this repo:
- Caches resolved JDK releases to avoid repeated vendor API lookups on
floating versions (`11`, `17`, `21`, `25`, `26`) and supports Temurin
4-segment patch versions (such as `26.0.2.1+1`).
- Preserves `~/.m2/toolchains.xml` across repeated `setup-java` steps in
the same job (used by the Java 8 jobs that install both JDK 8 and JDK
11/17).
- Migrates `distribution: zulu` workflows from the legacy Zulu Discovery
API to the Azul Metadata API.
- Makes the Java problem matcher opt-in by default (`v6.3.0`), avoiding
truncated inline compiler warning annotations on PR diffs while keeping
full diagnostics in build logs.
- Supports configuring Maven mirrors and repositories directly in
generated `settings.xml` (`v6.0.0`–`v6.2.0`), which future follow-ups
can use for the GCS Maven Central mirror instead of copying
`settings.xml` manually in scripts.
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