Browse Source

Use buildset registry push endpoint

When copying images from the intermediate registry to the buildset
registry, use the new push endpoint of the dual-registry system.

Also, use the push endpoint after a docker build to push the
new image to the buildset registry.

Change-Id: I3a11036bb9fb7cb3457a3d744fa83647c1b1b085
changes/20/638520/2
James E. Blair 3 months ago
parent
commit
a358f21736

+ 2
- 2
roles/build-docker-image/tasks/push.yaml View File

@@ -1,12 +1,12 @@
1 1
 - name: Tag image for buildset registry
2 2
   command: >-
3
-    docker tag {{ image.repository }}:{{ image_tag }} {{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ image.repository }}:{{ image_tag }}
3
+    docker tag {{ image.repository }}:{{ image_tag }} {{ buildset_registry.push_host }}:{{ buildset_registry.push_port }}/{{ image.repository }}:{{ image_tag }}
4 4
   loop: "{{ image.tags | default(['latest']) }}"
5 5
   loop_control:
6 6
     loop_var: image_tag
7 7
 - name: Push tag to buildset registry
8 8
   command: >-
9
-    docker push {{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ image.repository }}:{{ image_tag }}
9
+    docker push {{ buildset_registry.push_host }}:{{ buildset_registry.push_port }}/{{ image.repository }}:{{ image_tag }}
10 10
   loop: "{{ image.tags | default(['latest']) }}"
11 11
   loop_control:
12 12
     loop_var: image_tag

+ 3
- 7
roles/pull-from-intermediate-registry/tasks/main.yaml View File

@@ -5,23 +5,19 @@
5 5
     buildset_registry: "{{ (lookup('file', zuul.executor.work_root + '/results.json') | from_json)['buildset_registry'] }}"
6 6
 - name: Ensure registry cert directory exists
7 7
   file:
8
-    path: "/etc/docker/certs.d/{{ buildset_registry.host }}:{{ buildset_registry.port }}/"
9
-    state: directory
10
-- name: Ensure registry cert directory exists
11
-  file:
12
-    path: "/etc/docker/certs.d/{{ buildset_registry.host }}:{{ buildset_registry.port }}/"
8
+    path: "/etc/docker/certs.d/{{ buildset_registry.push_host }}:{{ buildset_registry.push_port }}/"
13 9
     state: directory
14 10
 - name: Write registry TLS certificate
15 11
   copy:
16 12
     content: "{{ buildset_registry.cert }}"
17
-    dest: "/etc/docker/certs.d/{{ buildset_registry.host }}:{{ buildset_registry.port }}/ca.crt"
13
+    dest: "/etc/docker/certs.d/{{ buildset_registry.push_host }}:{{ buildset_registry.push_port }}/ca.crt"
18 14
 - name: Pull artifact from intermediate registry
19 15
   command: >-
20 16
     skopeo --insecure-policy copy
21 17
     --src-creds={{ intermediate_registry.username }}:{{ intermediate_registry.password }}
22 18
     --dest-creds={{ buildset_registry.username }}:{{ buildset_registry.password }}
23 19
     {{ item.url }}
24
-    docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ item.metadata.repository }}:{{ item.metadata.tag }}
20
+    docker://{{ buildset_registry.push_host }}:{{ buildset_registry.push_port }}/{{ item.metadata.repository }}:{{ item.metadata.tag }}
25 21
   when: "item.metadata.type | default('') == 'container_image'"
26 22
   loop: "{{ zuul.artifacts | default([]) }}"
27 23
   # no_log: true  TODO(corvus): replace

+ 8
- 0
roles/use-buildset-registry/README.rst View File

@@ -17,6 +17,14 @@ Use this role on any host which should use the buildset registry.
17 17
 
18 18
       The port on which the registry is listening.
19 19
 
20
+   .. zuul:rolevar:: push_host
21
+
22
+      The host (IP address) to use when pushing images to the registry.
23
+
24
+   .. zuul:rolevar:: push_port
25
+
26
+      The port to use when pushing images to the registry.
27
+
20 28
    .. zuul:rolevar:: username
21 29
 
22 30
       The username used to access the registry via HTTP basic auth.

Loading…
Cancel
Save