tests: Add regression test for manifests
Due to a bug in Docker[1], it fails to create the manifest manually due to a missing header when Docker runs a ping to the API. This has been fixed in the development branch but it will likely take time for it to trickle down. This is the first patch of two which will demonstrate the actual failure, with another follow-up patch which will demonstrate the fix. [1]: https://github.com/docker/cli/issues/3161 Change-Id: I1f5c3121c58f93503be92c5ea3c4ae446cc44938
This commit is contained in:
parent
20f50e0ae7
commit
081352b299
@ -49,6 +49,45 @@
|
||||
- name: Remove the test image from the local cache
|
||||
command: docker rmi localhost:9000/test/image
|
||||
|
||||
- name: Pull down the manifest for Alpine
|
||||
command: docker manifest inspect docker.io/library/alpine:3
|
||||
register: _docker_manifest_inspect
|
||||
|
||||
- name: Generate facts containing all the manifest tags
|
||||
set_fact:
|
||||
_alpine_tags:
|
||||
amd64: "{{ _docker_manifest_inspect.stdout | trim | from_json | json_query('manifests[?platform.architecture == `amd64`].digest') | first }}"
|
||||
arm64: "{{ _docker_manifest_inspect.stdout | trim | from_json | json_query('manifests[?platform.architecture == `arm64`].digest') | first }}"
|
||||
|
||||
- name: Pull down an image for two different architectures
|
||||
command: docker pull docker.io/library/alpine@{{ item.value }}
|
||||
with_dict: "{{ _alpine_tags }}"
|
||||
|
||||
- name: Retag both images and upload them to Zuul registry
|
||||
command: docker tag docker.io/library/alpine@{{ item.value }} localhost:9000/alpine:3-{{ item.key }}
|
||||
with_dict: "{{ _alpine_tags }}"
|
||||
|
||||
- name: Push both retagged images
|
||||
command: docker push localhost:9000/alpine:3-{{ item.key }}
|
||||
with_dict: "{{ _alpine_tags }}"
|
||||
|
||||
- name: Create a manifest with multi architecture images
|
||||
command: docker manifest create localhost:9000/alpine:3 localhost:9000/alpine:3-amd64 localhost:9000/alpine:3-arm64
|
||||
# NOTE(mnaser): This should fail because of the following bug:
|
||||
# https://github.com/docker/cli/issues/3161
|
||||
register: result
|
||||
failed_when: result.rc != 1
|
||||
|
||||
- name: Wipe all images from the local cache (tagged in DockerHub)
|
||||
command: docker rmi docker.io/library/alpine@{{ item.value }}
|
||||
with_dict: "{{ _alpine_tags }}"
|
||||
|
||||
- name: Wipe all images from the local cache (tagged in the registry)
|
||||
command: docker rmi {{ item }}
|
||||
loop:
|
||||
- localhost:9000/alpine:3-amd64
|
||||
- localhost:9000/alpine:3-arm64
|
||||
|
||||
- name: Stop the registry
|
||||
shell:
|
||||
cmd: docker-compose down
|
||||
|
Loading…
Reference in New Issue
Block a user