Skip to content

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

Merged
rohanKanojia merged 1 commit into
fabric8io:masterfrom
sdumitriu:dockerfile-from-as-arg
Dec 9, 2023
Merged

rohanKanojia merged 1 commit into
fabric8io:masterfrom
sdumitriu:dockerfile-from-as-arg

Conversation

@sdumitriu

Copy link
Copy Markdown
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.

@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2023

Copy link
Copy Markdown

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
Copy Markdown
Member

@sdumitriu : Thanks a lot!

@rohanKanojia
rohanKanojia merged commit 452123d into fabric8io:master Dec 9, 2023
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 <rohaan@redhat.com>
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 <rohaan@redhat.com>
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 <rohaan@redhat.com>
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 <rohaan@redhat.com>
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