ansible / ansible-builder

An Ansible execution environment builder
Other
287 stars 93 forks source link

Equivalent to podman build --pull? #668

Closed ursetto closed 2 months ago

ursetto commented 5 months ago

podman build has a --pull option that sets pull policy for the base image when building a new image. By default, this is missing.

There appears to be no way to set or override this pull policy in ansible-builder. This means that if you have a base image of tag :latest, it will never be updated by builder after the initial pull.

Is there any way to get ansible-builder to update the base image when it runs? If not, I think a --pull option would be a useful addition to builder. This could be upgraded to --pull-always if container policy requires it, e.g. with signature_required.

I don't want to do a separate podman pull of the image beforehand, because that means I have to repeat the base image name in the schema and in the podman pull.

kurokobo commented 5 months ago

As a workaround, you can create context directory including Dockerfile by ansible-builder create command first, then build the context by podman build command with --pull=always.

ansible-builder create --verbosity 3
podman build --tag registry.example.com/ansible/ee:2.15-custom --pull=always context
Shrews commented 3 months ago

I've been experimenting with an option to pass extra arguments through to podman build (or docker build) command.

https://github.com/ansible/ansible-builder/pull/677

It's mostly there, I just need to find some time to clean it up a bit, but it should give you what you want.