zuul-registry/playbooks/functional-test/docker-buildset.yaml
James E. Blair 8772465ecc Disable namespacing
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
2019-10-21 09:47:41 -07:00

94 lines
2.5 KiB
YAML

# Test push and pull from the buildset registry
- name: Create new docker daemon config
set_fact:
new_daemon_config:
registry-mirrors:
- "https://localhost:9000"
- name: Write docker daemon configuration
copy:
content: "{{ new_daemon_config | to_nice_json }}"
dest: /etc/docker/daemon.json
become: true
- name: Restart docker daemon
service:
name: docker
state: restarted
become: true
register: docker_restart
failed_when: docker_restart is failed and not 'Could not find the requested service' in docker_restart.msg
- 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: Copy the test image into the buildset registry
command: >
skopeo copy --dest-creds testuser:testpass
docker-archive:{{ workspace }}/test.img
docker://localhost:9000/test/image:latest
- name: Print list of images
command: docker image ls --all --digests --no-trunc
register: image_list
failed_when:
- "'test/image' in image_list.stdout"
- "'alpine' in image_list.stdout"
- name: Pull the image from the buildset registry
command: docker pull test/image
- name: Print list of images
command: docker image ls --all --digests --no-trunc
register: image_list
failed_when: "'test/image' not in image_list.stdout"
- name: Try to pull an image that does not exist
command: docker pull test/dne
register: result
failed_when: result.rc != 1
- name: Pull an image from upstream
command: docker pull alpine
- name: Print list of images
command: docker image ls --all --digests --no-trunc
register: image_list
failed_when: "'alpine' not in image_list.stdout"
- name: Remove the test image from the local cache
command: docker rmi test/image
- name: Remove the test image from the local cache
command: docker rmi alpine
- 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