8772465ecc
We don't strictly need namespacing in order to have a buildset registry serve as multiple registries. If we don't configure it in zuul-registry itself, and treat dockerhub images as non-namespaced, then both docker and oci configurations can use the same buildset registry. We would configure docker to talk to the registry as normal and it will fetch unqualified image names, but we would set up containers/registries.conf to prepend urls for non-dockerhub registries, and it would not prepend anything for dockerhub. In this way, both configurations can use the same buildset registry. Change-Id: I8af4ea0f5da5ad835384400108250e14a8435656
114 lines
3.3 KiB
YAML
114 lines
3.3 KiB
YAML
# Test push and pull from the buildset registry
|
|
|
|
- name: Create new registries.conf
|
|
copy:
|
|
dest: /etc/containers/registries.conf
|
|
src: files/registries.conf
|
|
become: true
|
|
|
|
- name: Start the registry
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
|
|
|
|
- name: Wait for registry to come up
|
|
uri:
|
|
url: https://localhost:9000/v2/
|
|
validate_certs: false
|
|
status_code: 401
|
|
register: result
|
|
until: result.status is defined and result.status == 401
|
|
delay: 1
|
|
retries: 120
|
|
|
|
- name: Create new docker user config
|
|
set_fact:
|
|
new_user_config: {}
|
|
|
|
- name: Write docker user configuration
|
|
copy:
|
|
content: "{{ new_user_config | to_nice_json }}"
|
|
dest: ~/.docker/config.json
|
|
|
|
- name: Write containers auth configuration
|
|
copy:
|
|
content: "{{ new_user_config | to_nice_json }}"
|
|
dest: "/run/user/{{ ansible_user_uid }}/auth.json"
|
|
|
|
- name: Copy the test image into the registry
|
|
command: >
|
|
skopeo copy --dest-creds testuser:testpass
|
|
docker-archive:{{ workspace }}/test.img
|
|
docker://localhost:9000/test/image:latest
|
|
|
|
- name: Copy the test image into the registry
|
|
command: >
|
|
skopeo copy --dest-creds testuser:testpass
|
|
docker-archive:{{ workspace }}/test.img
|
|
docker://localhost:9000/quay.io/test/quay-image:latest
|
|
|
|
- name: Print list of images
|
|
command: podman image ls --all --digests --no-trunc
|
|
register: image_list
|
|
failed_when:
|
|
- "'test/image' in image_list.stdout"
|
|
- "'test/quay-image' in image_list.stdout"
|
|
- "'alpine' in image_list.stdout"
|
|
|
|
- name: Pull the shadowed docker image from the registry
|
|
command: podman pull test/image
|
|
|
|
- name: Print list of images
|
|
command: podman image ls --all --digests --no-trunc
|
|
register: image_list
|
|
failed_when: "'docker.io/test/image' not in image_list.stdout"
|
|
|
|
- name: Remove the test image from the local cache
|
|
command: podman rmi docker.io/test/image
|
|
|
|
- name: Pull the shadowed quay image from the registry
|
|
command: podman pull quay.io/test/quay-image
|
|
|
|
- name: Print list of images
|
|
command: podman image ls --all --digests --no-trunc
|
|
register: image_list
|
|
failed_when: "'quay.io/test/quay-image' not in image_list.stdout"
|
|
|
|
- name: Remove the test image from the local cache
|
|
command: podman rmi quay.io/test/quay-image
|
|
|
|
- name: Try to pull an image that does not exist
|
|
command: podman pull test/dne
|
|
register: result
|
|
failed_when: result.rc != 125
|
|
|
|
- name: Pull an image from docker.io
|
|
command: podman pull alpine
|
|
|
|
- name: Print list of images
|
|
command: podman image ls --all --digests --no-trunc
|
|
register: image_list
|
|
failed_when: "'docker.io/library/alpine' not in image_list.stdout"
|
|
|
|
- name: Remove the test image from the local cache
|
|
command: podman rmi docker.io/library/alpine
|
|
|
|
- name: Pull an image from quay.io
|
|
command: podman pull quay.io/0xff/alpine-sshd
|
|
|
|
- name: Print list of images
|
|
command: podman image ls --all --digests --no-trunc
|
|
register: image_list
|
|
failed_when: "'quay.io/0xff/alpine-sshd' not in image_list.stdout"
|
|
|
|
- name: Remove the test image from the local cache
|
|
command: podman rmi quay.io/0xff/alpine-sshd
|
|
|
|
- name: Stop the registry
|
|
shell:
|
|
cmd: docker-compose down
|
|
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
|
|
|
|
- name: Clean up docker volumes
|
|
command: docker volume prune -f
|