ansible-builder icon indicating copy to clipboard operation
ansible-builder copied to clipboard

Equivalent to podman build --pull?

Open ursetto opened this issue 10 months ago • 1 comments

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.

ursetto avatar Mar 29 '24 15:03 ursetto

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

kurokobo avatar Mar 30 '24 11:03 kurokobo

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.

Shrews avatar May 22 '24 16:05 Shrews