playbooks, test/system: Avoid downloading the images multiple times
Since commit b27795a03e
, each section of the test suite starts
and ends with a clean Podman state. This includes removing all images
from the local containers storage. Therefore, the images get downloaded
multiple times during the course of the test suite.
This commit restores the earlier behaviour where the images would get
downloaded only once, by copying them to separate directories outside
the local containers storage and then restoring them when the tests
are run.
https://github.com/containers/toolbox/pull/517
https://github.com/containers/toolbox/pull/704
This commit is contained in:
parent
285a54ba5b
commit
7973181136
2 changed files with 19 additions and 32 deletions
|
@ -54,9 +54,22 @@
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 10
|
delay: 10
|
||||||
|
|
||||||
|
- name: Copy the default image to a directory
|
||||||
|
command:
|
||||||
|
cmd: "skopeo copy containers-storage:registry.fedoraproject.org/fedora-toolbox:{{ ansible_distribution_version }} dir:{{ zuul.project.src_dir }}/fedora-toolbox-{{ ansible_distribution_version }}"
|
||||||
|
creates: "{{ zuul.project.src_dir }}/fedora-toolbox-{{ ansible_distribution_version }}/manifest.json"
|
||||||
|
|
||||||
- name: Pull registry.fedoraproject.org/f29/fedora-toolbox:29
|
- name: Pull registry.fedoraproject.org/f29/fedora-toolbox:29
|
||||||
command: podman pull registry.fedoraproject.org/f29/fedora-toolbox:29
|
command: podman pull registry.fedoraproject.org/f29/fedora-toolbox:29
|
||||||
register: _podman
|
register: _podman
|
||||||
until: _podman.rc == 0
|
until: _podman.rc == 0
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 10
|
delay: 10
|
||||||
|
|
||||||
|
- name: Copy registry.fedoraproject.org/f29/fedora-toolbox:29 to a directory
|
||||||
|
command:
|
||||||
|
cmd: "skopeo copy containers-storage:registry.fedoraproject.org/f29/fedora-toolbox:29 dir:{{ zuul.project.src_dir }}/fedora-toolbox-29"
|
||||||
|
creates: "{{ zuul.project.src_dir }}/fedora-toolbox-29/manifest.json"
|
||||||
|
|
||||||
|
- name: Clean up the local containers storage
|
||||||
|
command: podman system reset --force
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
# Podman and Toolbox commands to run
|
# Podman and Toolbox commands to run
|
||||||
readonly PODMAN=${PODMAN:-podman}
|
readonly PODMAN=${PODMAN:-podman}
|
||||||
readonly TOOLBOX=${TOOLBOX:-toolbox}
|
readonly TOOLBOX=${TOOLBOX:-toolbox}
|
||||||
|
readonly SKOPEO=$(command -v skopeo)
|
||||||
|
readonly PROJECT_DIR=${PWD}
|
||||||
|
|
||||||
# Helpful globals
|
# Helpful globals
|
||||||
current_os_version=$(awk -F= '/VERSION_ID/ {print $2}' /etc/os-release)
|
current_os_version=$(awk -F= '/VERSION_ID/ {print $2}' /etc/os-release)
|
||||||
|
@ -30,50 +32,22 @@ function get_busybox_image() {
|
||||||
function pull_image() {
|
function pull_image() {
|
||||||
local version
|
local version
|
||||||
local image
|
local image
|
||||||
local -i count
|
|
||||||
local -i max_retries
|
|
||||||
local -i wait_time
|
|
||||||
version="$1"
|
version="$1"
|
||||||
image="${REGISTRY_URL}/fedora-toolbox:${version}"
|
image="${REGISTRY_URL}/fedora-toolbox:${version}"
|
||||||
count=0
|
|
||||||
max_retries=5
|
|
||||||
wait_time=15
|
|
||||||
|
|
||||||
until ${PODMAN} pull "${image}" >/dev/null ; do
|
$SKOPEO copy "dir:${PROJECT_DIR}/fedora-toolbox-${version}" "containers-storage:${image}"
|
||||||
sleep $wait_time
|
$PODMAN images
|
||||||
(( count += 1 ))
|
|
||||||
|
|
||||||
if (( "$count" == "$max_retries" )); then
|
|
||||||
# Max number of retries exceeded
|
|
||||||
echo "Podman couldn't pull the image ${image}."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function pull_image_old() {
|
function pull_image_old() {
|
||||||
local version
|
local version
|
||||||
local image
|
local image
|
||||||
local -i count
|
|
||||||
local -i max_retries
|
|
||||||
local -i wait_time
|
|
||||||
version="$1"
|
version="$1"
|
||||||
image="${REGISTRY_URL}/f${version}/fedora-toolbox:${version}"
|
image="${REGISTRY_URL}/f${version}/fedora-toolbox:${version}"
|
||||||
count=0
|
|
||||||
max_retries=5
|
|
||||||
wait_time=15
|
|
||||||
|
|
||||||
until ${PODMAN} pull "${image}" >/dev/null ; do
|
$SKOPEO copy "dir:${PROJECT_DIR}/fedora-toolbox-${version}" "containers-storage:${image}"
|
||||||
sleep $wait_time
|
$PODMAN images
|
||||||
(( count += 1 ))
|
|
||||||
|
|
||||||
if (( "$count" == "$max_retries" )); then
|
|
||||||
# Max number of retries exceeded
|
|
||||||
echo "Podman couldn't pull the image ${image}."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue