zuul-registry/playbooks/functional-test/setup.yaml
Clark Boylan 8dfb9dc968 Add more robust testing of the registry
We use a non trivial image now (the registry's image in fact) and then
push with 4 processes at a time every time we push to the test registry.
The idea here is we're generating concurrency in the system that should
trip over the bugs that we are finding if they still exist.

Change-Id: I4f03132fa0fad6f40806030b14d429d29036a42f
2022-02-28 14:19:03 -08:00

79 lines
2.4 KiB
YAML

- name: Create workspace directory
file:
state: directory
path: "{{ workspace }}"
- name: Create storage directory
file:
state: directory
path: "{{ workspace }}/storage"
- name: Create TLS directory
file:
state: directory
path: "{{ workspace }}/tls"
- name: Generate a TLS key for the registry
command: "openssl req -x509 -newkey rsa:2048 -keyout {{ workspace }}/tls/cert.key -out {{ workspace }}/tls/cert.pem -days 365 -nodes -subj '/C=US/ST=California/L=Oakland/O=Company Name/OU=Org/CN=localhost' -addext 'subjectAltName = DNS:localhost,IP:127.0.0.1'"
- name: Install the CA cert
command: "cp {{ workspace }}/tls/cert.pem /usr/local/share/ca-certificates/test.crt"
become: true
- name: Update CA certs
command: update-ca-certificates
become: true
- name: Check if docker daemon configuration exists
stat:
path: /etc/docker/daemon.json
register: daemon_config_stat
- name: Save docker daemon configuration
when: daemon_config_stat.stat.exists
command: "cp /etc/docker/daemon.json {{ workspace }}/docker-daemon.json"
- name: Check if docker user configuration exists
stat:
path: ~/.docker/config.json
register: user_config_stat
- name: Save docker user configuration
when: user_config_stat.stat.exists
command: "cp ~/.docker/config.json {{ workspace }}/docker-user.json"
- name: Check if registries.conf exists
stat:
path: /etc/containers/registries.conf
register: registries_conf_stat
- name: Save registries.conf
when: registries_conf_stat.stat.exists
command: "cp /etc/containers/registries.conf {{ workspace }}/registries.conf"
- name: Check if containers user auth exists
stat:
path: "/run/user/{{ ansible_user_uid }}/auth.json"
register: containers_auth_stat
- name: Save containers user auth
when: containers_auth_stat.stat.exists
command: "cp /run/user/{{ ansible_user_uid }}/auth.json {{ workspace }}/containers-auth.json"
- name: Create a local containers image
shell: buildah commit --rm $(buildah from docker.io/zuul/zuul-registry) testimage
- name: Ensure image file is not present
file:
path: "{{ workspace }}/test.img"
state: absent
- name: Copy the local image to a file
command: >
skopeo copy
containers-storage:localhost/testimage:latest
docker-archive:{{ workspace }}/test.img
- name: Remove test image from containers storage
command: podman rmi localhost/testimage:latest