1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Trigger a new image build when we detect that the Containerfile has changed. (#811)

* Trigger a new image build when we detect that the Containerfile has
changed.

Signed-off-by: gw <gw@bob.lol>

* Fix return type issues from PR feedback

Signed-off-by: gw <gw@bob.lol>

---------

Signed-off-by: gw <gw@bob.lol>
Co-authored-by: gw <gw@bob.lol>
This commit is contained in:
SkrrtBacharach 2024-09-23 20:36:33 +01:00 committed by GitHub
parent 2adc93ffb1
commit 58edc41196
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 124 additions and 3 deletions

View file

@ -237,6 +237,29 @@
register: oci_build6
ignore_errors: true
- name: Build OCI image testimage6 twice with the same Containerfile
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: testimage6
state: build
build:
format: oci
container_file: |-
FROM quay.io/coreos/alpine-sh
register: oci_build7
loop: [0, 1]
- name: Build OCI image testimage6 with a different Containerfile
containers.podman.podman_image:
executable: "{{ test_executable | default('podman') }}"
name: testimage6
state: build
build:
format: oci
container_file: |-
FROM docker.io/alpine
register: oci_build8
- name: Inspect first image
containers.podman.podman_image_info:
executable: "{{ test_executable | default('podman') }}"
@ -259,6 +282,13 @@
- oci_build4 is success
- oci_build5 is success
- oci_build6 is failed
# The following line tests that building an image twice with
# the same Containerfile doesn't rebuild the image.
- oci_build7.results[1] is not changed
# oci_build8 tests that building an image with the same name
# but a different Containerfile results in a new image being
# built.
- oci_build8 is changed
- "'localhost/testimage:latest' in testimage_info.images[0]['RepoTags'][0]"
- "'localhost/testimage2:latest' in testimage2_info.images[0]['RepoTags'][0]"
- "'no such file or directory' in oci_build3.msg"