From d5f7655464ed942a368e317f99e39bc14acf0794 Mon Sep 17 00:00:00 2001 From: Sergey <6213510+sshnaidm@users.noreply.github.com> Date: Mon, 3 Apr 2023 23:56:11 +0300 Subject: [PATCH] Support SHA256 tag for podman images (#570) Fix #569 Signed-off-by: Sagi Shnaidman --- plugins/modules/podman_image.py | 3 ++- .../integration/targets/podman_image/tasks/main.yml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/modules/podman_image.py b/plugins/modules/podman_image.py index 92ab33e..570417b 100644 --- a/plugins/modules/podman_image.py +++ b/plugins/modules/podman_image.py @@ -428,7 +428,8 @@ class PodmanImageManager(object): self.name = repo self.tag = repo_tag - self.image_name = '{name}:{tag}'.format(name=self.name, tag=self.tag) + delimiter = ':' if "sha256" not in self.tag else '@' + self.image_name = '{name}{d}{tag}'.format(name=self.name, d=delimiter, tag=self.tag) if self.state in ['present', 'build']: self.present() diff --git a/tests/integration/targets/podman_image/tasks/main.yml b/tests/integration/targets/podman_image/tasks/main.yml index 4abf635..7a72bfb 100644 --- a/tests/integration/targets/podman_image/tasks/main.yml +++ b/tests/integration/targets/podman_image/tasks/main.yml @@ -152,6 +152,18 @@ - specific_image2 is not changed - "'v3.3.11' in images.stdout" + - name: Get info about pulled image + containers.podman.podman_image_info: + executable: "{{ test_executable | default('podman') }}" + name: quay.io/coreos/etcd:v3.3.11 + register: sha_image_info + + - name: Pull image with SHA256 tag + containers.podman.podman_image: + executable: "{{ test_executable | default('podman') }}" + name: "quay.io/coreos/etcd@{{ sha_image_info.images.0.Digest }}" #quay.io/coreos/coreos-installer:latest + state: present + - name: Create a build directory with a subdirectory file: path: /var/tmp/build/subdir