This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce podman sanity checks (#417)
* roles: podman_pull_run_remove This introduces a new role named `podman_pull_run_remove` which is a implementation of `docker_pull_run_remove` using `podman`. The role has been enhanced to test basic running of containers and also testing network access from the container. (These enhancements should likely be applied to `docker_pull_run_remove`, too). * i-s-t: add basic podman tests Let's start testing `podman` on the hosts that support it. * roles: fix centos container image location * roles: use alternate set of images for CentOS CentOS AH is missing the Red Hat CA cert, so it is unable to pull images from the registry (see: CentOS/sig-atomic-buildscripts#329). To workaround this, we'll have to build the list of images to pull differently for CentOS vs. the rest.
- Loading branch information
1 parent
2b65dc8
commit 494eb7c
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
# vim: set ft=ansible: | ||
allow_duplicates: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
# vim: set ft=ansible: | ||
# | ||
# This is a copy of the `docker_pull_run_remove` role which has been adapted | ||
# to use `podman`. There are some minor changes that expand on the original | ||
# role to make this more comprehensive. | ||
# | ||
# `popular_images` is defined in roles/podman_pull_run_remove/vars/main.yml | ||
# It is a dict using image names as a key and the value is a command that | ||
# can be run. | ||
# | ||
|
||
# Check to see if the host has podman, but don't fail if it is not installed | ||
- name: Check if podman is installed | ||
command: rpm -q podman | ||
register: podman | ||
ignore_errors: true | ||
|
||
- when: "'CentOS' not in ansible_distribution" | ||
set_fact: | ||
pull_images: "{{ popular_images | combine(rhel_images) }}" | ||
|
||
- when: "'CentOS' in ansible_distribution" | ||
set_fact: | ||
pull_images: "{{ popular_images }}" | ||
|
||
- when: podman.rc == 0 | ||
block: | ||
- name: Disable the docker daemon | ||
service: | ||
name: docker | ||
state: stopped | ||
|
||
- name: Pull the popular container images | ||
command: "podman pull {{ item.key }}" | ||
with_dict: "{{ pull_images }}" | ||
register: podman_pull | ||
retries: 5 | ||
delay: 60 | ||
until: podman_pull is success | ||
|
||
- name: Run the popular container images | ||
command: "podman run --rm {{ item.key }} echo 'hello'" | ||
with_dict: "{{ pull_images }}" | ||
|
||
# Test for https://bugzilla.redhat.com/show_bug.cgi?id=1585735 | ||
- name: Run the popular container images with cpu-shares flag | ||
command: "podman run --cpu-shares 2 --rm {{ item.key }} echo 'hello'" | ||
with_dict: "{{ pull_images }}" | ||
|
||
# Test for https://bugzilla.redhat.com/show_bug.cgi?id=1592932 | ||
# https://bugzilla.redhat.com/show_bug.cgi?id=1593419 | ||
- name: Run the popular container images testing for network access | ||
command: "podman run --rm {{ item.key }} {{ item.value }}" | ||
with_dict: "{{ pull_images }}" | ||
|
||
- name: Remove the popular container images | ||
command: "podman rmi {{ item.key }}" | ||
with_dict: "{{ pull_images }}" | ||
|
||
- name: Re-enable docker | ||
service: | ||
name: docker | ||
state: started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
# vim: set ft=ansible: | ||
# | ||
popular_images: | ||
docker.io/alpine: 'ping -c 3 1.1.1.1' | ||
docker.io/busybox: 'ping -c 3 1.1.1.1' | ||
docker.io/ubuntu: 'bash -c "apt-get update && apt-get -y install iputils-ping && ping -c 3 1.1.1.1"' | ||
registry.fedoraproject.org/fedora: 'bash -c "dnf -y install iputils && ping -c 3 1.1.1.1"' | ||
registry.centos.org/centos/centos: 'ping -c 3 1.1.1.1' | ||
|
||
rhel_images: | ||
registry.access.redhat.com/rhel: 'curl --fail -o /dev/null -I https://1.1.1.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters