Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using maven/system properties for an ARG used as the FROM image in a dockerfile #1731

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

sdumitriu
Copy link
Contributor

Scenario: build using a Dockerfile, I'm trying to configure the base image using an ARG, as in:

ARG baseImage=some/project:version
FROM $baseImage
...

This works as long as I don't want a different base image, or if I configure it in the image settings. In theory docker.buildArg.baseImage=ghcr.io/some/otherProject:otherVersion should allow changing that value, but that doesn't work since the autoPullBaseImage code only looks in the image buildArg configuration.

This PR adds support for looking at all the arg configurations, no matter where they're coming from.

Copy link

sonarcloud bot commented Dec 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@rohanKanojia
Copy link
Member

@sdumitriu : Thanks a lot!

@rohanKanojia rohanKanojia merged commit 452123d into fabric8io:master Dec 9, 2023
9 checks passed
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this pull request Feb 23, 2024
…ile pulling images (fabric8io#1756)

Fixes regression introduced by fabric8io#1731

In fabric8io#1731, we added support for specifying docker build args from
maven/system properties. However, I missed it in review that build args
specified in plugin image build configuration are no longer passed to
autoPullBaseImage.

Ensure we merge image build configuration build args with args provided
via maven/system properties before passing them to autoPullBaseImage

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this pull request Feb 23, 2024
…ile pulling images (fabric8io#1756)

Fixes regression introduced by fabric8io#1731

In fabric8io#1731, we added support for specifying docker build args from
maven/system properties. However, I missed it in review that build args
specified in plugin image build configuration are no longer passed to
autoPullBaseImage.

Ensure we merge image build configuration build args with args provided
via maven/system properties before passing them to autoPullBaseImage

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit to rohanKanojia/docker-maven-plugin that referenced this pull request Feb 24, 2024
…ile pulling images (fabric8io#1756)

Fixes regression introduced by fabric8io#1731

In fabric8io#1731, we added support for specifying docker build args from
maven/system properties. However, I missed it in review that build args
specified in plugin image build configuration are no longer passed to
autoPullBaseImage.

Ensure we merge image build configuration build args with args provided
via maven/system properties before passing them to autoPullBaseImage

Signed-off-by: Rohan Kumar <[email protected]>
rohanKanojia added a commit that referenced this pull request Feb 24, 2024
…ile pulling images (#1756)

Fixes regression introduced by #1731

In #1731, we added support for specifying docker build args from
maven/system properties. However, I missed it in review that build args
specified in plugin image build configuration are no longer passed to
autoPullBaseImage.

Ensure we merge image build configuration build args with args provided
via maven/system properties before passing them to autoPullBaseImage

Signed-off-by: Rohan Kumar <[email protected]>
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