zuul-registry/playbooks/functional-test/main.yaml
Tristan Cacqueray 6722875907 Add support for skopeo copy
This change fixes the API to support skopeo that except status code 201
on creation.

Change-Id: I28e4ca5c19f935d0ecbf916d5f89fbb4ca068c19
2019-10-05 07:45:48 -07:00

69 lines
2.1 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=127.0.0.1'"
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry/playbooks/functional-test"
- name: Print list of images
command: docker image ls --all --digests --no-trunc
- name: Pull the test image from Docker Hub
command: docker pull alpine
- name: Tag the test image with a realistic name
command: docker tag alpine localhost:9000/test/registry
- name: Log in to local registry
command: docker login localhost:9000 -u testuser -p testpass
ignore_errors: true
- name: Push the test image to zuul-registry
command: docker image push localhost:9000/test/registry
- name: Remove the test image from the local cache
command: docker rmi localhost:9000/test/registry
- name: Remove the test image from the local cache
command: docker rmi alpine:latest
- name: Clean up the local image cache
command: docker image prune -f
- name: Print list of images
command: docker image ls --all --digests --no-trunc
- name: Pull the image from zuul-registry
command: docker image pull localhost:9000/test/registry
- name: Print list of images
command: docker image ls --all --digests --no-trunc
- name: Create a local containers/image
shell: buildah commit --rm $(buildah from scratch) local-test
- name: Check the local image is there
command: skopeo inspect containers-storage:localhost/local-test:latest
- name: Copy the local image to the registry
command: >
skopeo copy --dest-creds testuser:testpass --dest-tls-verify=false
containers-storage:localhost/local-test:latest
docker://127.0.0.1:9000/test