Skip to content

Feature: Add generic option to docker image#23250

Open
tim-werner wants to merge 9 commits intopantsbuild:mainfrom
tim-werner:add-generic-option-to-docker-image
Open

Feature: Add generic option to docker image#23250
tim-werner wants to merge 9 commits intopantsbuild:mainfrom
tim-werner:add-generic-option-to-docker-image

Conversation

@tim-werner
Copy link
Copy Markdown
Contributor

This pull request allows it now to add generic build options to docker/podman build. It will also work as a workaround for issue: #21450

It is now possible to use pass generic build options to docker and podman. The old arguments such as pull on docker_image target level or no-cache on global level will still work, however the new build_extra_option will have precedence.

AI was used to find the right locations in the code base for the changes and to write the tests faster. However, most of the code was written by human.

This is an improvement of pull request: #23032

@tim-werner tim-werner force-pushed the add-generic-option-to-docker-image branch from 124c44c to 99f5e5d Compare April 14, 2026 14:15
@tobni tobni self-assigned this Apr 17, 2026
@tobni tobni self-requested a review April 17, 2026 16:46
Copy link
Copy Markdown
Contributor

@tobni tobni left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for the contribution!

The feature looks well thought out w.r.t how options should be propagated, and I agree with the general direction of providing a list of args instead of adding a new option for each arg.

I am however not going to review the test cases before you do. Happy to once they at least conform to the style of the test file where they were introduced.

Comment thread src/python/pants/backend/docker/goals/package_image.py Outdated
Comment thread src/python/pants/backend/docker/goals/package_image.py Outdated
Comment thread src/python/pants/backend/docker/goals/package_image.py Outdated
Comment thread src/python/pants/backend/docker/goals/package_image_test.py Outdated
@tim-werner
Copy link
Copy Markdown
Contributor Author

Hi @tobni ,
thank you very much for your time to review the pull request. I have updated the pull request to consider your suggestions. The tests are now condensed into two tests with parametrize options. I have not created a single test in order to keep it simple and in future we should conisder to drop the support of setting options such as pull, no-cache , target etc. in the docker_image directly and only allow to use the more general option that is proposed in this pull request.

@tim-werner tim-werner requested a review from tobni April 20, 2026 08:37
Copy link
Copy Markdown
Member

@sureshjoshi sureshjoshi left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. We've just branched for 2.32.x, so merging this pull request now will come out in 2.33.x, please move the release notes updates to docs/notes/2.33.x.md if that's appropriate.

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.

3 participants