Skip to content

Conversation

@yeikel
Copy link
Contributor

@yeikel yeikel commented Aug 24, 2025

Same idea as #12717

@github-actions github-actions bot added the L: java:gradle Maven packages via Gradle label Aug 24, 2025
@yeikel yeikel changed the title Simplify installation of gradle Simplify installation of gradle and automate upgrades Aug 24, 2025
@yeikel yeikel force-pushed the gradle-docker branch 2 times, most recently from 0a48f31 to 26a199e Compare August 24, 2025 23:56
@yeikel yeikel changed the title Simplify installation of gradle and automate upgrades Simplify gradle installation and automate upgrades Aug 24, 2025
@yeikel yeikel changed the title Simplify gradle installation and automate upgrades Simplify gradle installation and automate upgrades Aug 24, 2025
@yeikel yeikel force-pushed the gradle-docker branch 2 times, most recently from 47a1b7a to 1de201b Compare August 25, 2025 00:03
@yeikel yeikel marked this pull request as ready for review August 25, 2025 00:22
@yeikel yeikel requested a review from a team as a code owner August 25, 2025 00:22
Comment on lines 188 to 205
- package-ecosystem: "docker"
directory: "/gradle"
schedule:
interval: "weekly"
day: "sunday"
time: "16:00"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample pull request https://github.com/yeikel/dependabot-core/pull/84/files

We can consider limiting this to only minor or patch upgrades. I am open for feedback

RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-21-jdk \
ca-certificates-java \
wget \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wget is no longer needed

@AbhishekBhaskar AbhishekBhaskar moved this to Scoping in Dependabot Aug 26, 2025
@yeikel yeikel force-pushed the gradle-docker branch 3 times, most recently from dcb4ee7 to 3c1683d Compare August 30, 2025 00:20
@yeikel yeikel force-pushed the gradle-docker branch 2 times, most recently from 06a7d9f to 697b995 Compare September 5, 2025 23:24
@yeikel yeikel force-pushed the gradle-docker branch 3 times, most recently from 2bc32bb to 58ac6a3 Compare September 15, 2025 19:24
patterns:
- "regclient/regctl*"
- "sigstore/cosign/cosign*"
- package-ecosystem: "docker"

Check warning

Code scanning / zizmor

insufficient cooldown in Dependabot updates Warning

insufficient cooldown in Dependabot updates
@yeikel yeikel force-pushed the gradle-docker branch 4 times, most recently from 432e5c4 to 8253645 Compare December 4, 2025 13:43
Comment on lines -32 to -34
RUN set -o errexit -o nounset \
&& echo "Testing Gradle installation" \
&& gradle --version
Copy link
Contributor Author

@yeikel yeikel Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tested via the existing tests

@yeikel yeikel force-pushed the gradle-docker branch 6 times, most recently from 51fd628 to cd3f380 Compare December 9, 2025 18:54

FROM ghcr.io/dependabot/dependabot-updater-core

# Install Java
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is self-explanatory and the comment was just a distraction

@yeikel yeikel force-pushed the gradle-docker branch 2 times, most recently from 17bcc7f to e72007f Compare December 11, 2025 15:24
@yeikel
Copy link
Contributor Author

yeikel commented Dec 11, 2025

@kbukum1 Any chance you can review this as you reviewed #12717?

Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies Gradle installation by switching from manual download and installation to using the official Gradle Docker image, and adds Dependabot configuration to automate future Gradle version updates. This follows the same pattern established in PR #12717 for Maven.

Key changes:

  • Replaces manual Gradle installation (wget, sha256 verification, unzip) with the official gradle:8.14.3-jdk21-ubi-minimal Docker image
  • Adds Dependabot configuration for weekly automated updates of the Gradle Docker image
  • Updates from Gradle 8.14.2 to 8.14.3

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
gradle/Dockerfile Refactors to use official Gradle Docker image with multi-stage build pattern, removes manual installation logic, updates Java installation cleanup, and adjusts GRADLE_HOME/PATH configuration
.github/dependabot.yml Adds weekly Dependabot monitoring for the gradle Dockerfile to automate Gradle version updates

Comment on lines 10 to 18
# By using dependabot-updater-core as the builder, we inherit $DEPENDABOT_HOME
# We also need to include it below for the final build, and using it as a builder should not negatively impact build time
FROM ghcr.io/dependabot/dependabot-updater-core AS builder

# Copying all files from `$DEPENDABOT_HOME` with a builder consolidates the final copy into a single Docker layer
COPY --from=gradle /opt/gradle $DEPENDABOT_HOME/gradle-installation

COPY --chown=dependabot:dependabot --parents gradle maven common $DEPENDABOT_HOME
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builder pattern used here differs from the Maven Dockerfile which uses a simpler approach. The Maven Dockerfile (lines 3-16) directly copies from the maven image in the final stage without an intermediate builder. This adds complexity with the builder stage that may not be necessary.

Consider simplifying to match the Maven pattern:

FROM docker.io/gradle:8.14.3-jdk21-ubi-minimal@sha256:... AS gradle

FROM ghcr.io/dependabot/dependabot-updater-core

# ... apt-get install ...

COPY --from=gradle /opt/gradle $DEPENDABOT_HOME/gradle-installation

USER dependabot

ARG GRADLE_HOME=$DEPENDABOT_HOME/gradle-installation
ENV PATH=$GRADLE_HOME/bin:$PATH

COPY --chown=dependabot:dependabot --parents gradle maven common $DEPENDABOT_HOME/
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater

This would consolidate the COPY operations and eliminate the need for the intermediate builder stage, making it more consistent with the Maven approach.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builder is used to avoid unnecessary layers which improves the pull time

&& echo "Testing Gradle installation" \
&& gradle --version
COPY --from=builder $DEPENDABOT_HOME $DEPENDABOT_HOME

Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Gradle installation is no longer verified after installation. The previous version included a verification step that ran gradle --version to ensure the installation was successful. While the official Docker image is presumably tested, it would be safer to verify that Gradle is accessible on the PATH and functioning correctly in this environment.

Consider adding a verification step similar to what was removed, either as a RUN command or ensuring that the build process validates Gradle is available.

Suggested change
# Verify that Gradle is installed correctly and available on PATH
RUN gradle --version

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens via our existing tests

Comment on lines 14 to 15
# Copying all files from `$DEPENDABOT_HOME` with a builder consolidates the final copy into a single Docker layer
COPY --from=gradle /opt/gradle $DEPENDABOT_HOME/gradle-installation
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Copying all files from $DEPENDABOT_HOME with a builder consolidates the final copy into a single Docker layer", but this actually creates MORE layers, not fewer. The Maven Dockerfile accomplishes the same result with fewer stages and layers by directly copying from the maven image in the final stage.

The claim about layer consolidation appears to be incorrect since the builder pattern here adds an extra stage without reducing the number of COPY operations in the final image.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that Copilot is right about this one. I reverted that additional change for now

@yeikel yeikel force-pushed the gradle-docker branch 2 times, most recently from ccf72ed to d9665ca Compare December 29, 2025 17:01
@yeikel
Copy link
Contributor Author

yeikel commented Jan 1, 2026

@kbukum1 I applied all of Copilot's feedback. Could you please take a second look?

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

Labels

Projects

Status: Scoping

Development

Successfully merging this pull request may close these issues.

1 participant