From 67228759070b0cc0d457db133be3afe32e988221 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Fri, 4 Oct 2019 17:55:02 +0000 Subject: [PATCH] Add support for skopeo copy This change fixes the API to support skopeo that except status code 201 on creation. Change-Id: I28e4ca5c19f935d0ecbf916d5f89fbb4ca068c19 --- playbooks/functional-test/main.yaml | 12 ++++++++++++ playbooks/functional-test/run.yaml | 7 +++++++ zuul_registry/main.py | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/playbooks/functional-test/main.yaml b/playbooks/functional-test/main.yaml index 11efbac..844372a 100644 --- a/playbooks/functional-test/main.yaml +++ b/playbooks/functional-test/main.yaml @@ -54,3 +54,15 @@ - 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 diff --git a/playbooks/functional-test/run.yaml b/playbooks/functional-test/run.yaml index 301f142..991a47e 100644 --- a/playbooks/functional-test/run.yaml +++ b/playbooks/functional-test/run.yaml @@ -8,11 +8,18 @@ workspace: /tmp/registry-test local: false tasks: + - name: Add project atomic PPA + apt_repository: + repo: ppa:projectatomic/ppa + become: true + - name: Install packages package: name: - docker-compose - openssl + - skopeo + - buildah state: present become: true - name: Run main tasks diff --git a/zuul_registry/main.py b/zuul_registry/main.py index 8a8a9c1..64433af 100644 --- a/zuul_registry/main.py +++ b/zuul_registry/main.py @@ -172,7 +172,7 @@ class RegistryAPI: res.headers['Location'] = '/v2/%s/blobs/%s' % (repository, digest) res.headers['Docker-Content-Digest'] = digest res.headers['Content-Range'] = '%s-%s' % (old_length, new_length) - res.status = '204 No Content' + res.status = '201 Created' @cherrypy.expose @cherrypy.config(**{'tools.auth_basic.checkpassword': require_write})