Use full image url in container buildx path

The container roles assume a full image url path and do not work with
shorted names like the docker roles do. The buildx path used the shorted
path when it should use the full path. Fix this.

Change-Id: Icdeee0ebb1c0d280968f425f8560cc5208ebd18d
This commit is contained in:
Clark Boylan 2023-04-21 13:15:58 -07:00
parent b7f983c621
commit 4617d0835a
3 changed files with 13 additions and 17 deletions

View File

@ -4,10 +4,6 @@
fail:
msg: "{{ zj_image.repository }} must be a full container image url including registry location"
- name: Parse out repo path from full "url"
set_fact:
_repopath: "{{ (zj_image.repository | split('/', 1)).1 }}"
- name: Set container filename arg
set_fact:
containerfile: "{{ zj_image.container_filename | default(container_filename) | default('') }}"
@ -33,9 +29,9 @@
--build-arg "ZUUL_SIBLINGS={{ zj_image.siblings | join(' ') }}"
{% endif -%}
{% for tag in zj_image.tags | default(['latest']) -%}
--tag {{ temp_registry.host }}:{{ temp_registry.port }}/{{ _repopath }}:{{ tag }}
--tag {{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ tag }}
{% if buildset_registry | default(false) -%}
--tag {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ _repopath }}:{{ tag }}
--tag {{ buildset_registry_alias }}:{{ buildset_registry.port }}/{{ zj_image.repository }}:{{ tag }}
{% endif -%}
{% endfor -%}
{% for label in zj_image.labels | default([]) -%}
@ -53,7 +49,7 @@
- name: Pull images from temporary registry
command: >-
docker pull {{ temp_registry.host }}:{{ temp_registry.port }}/{{ _repopath }}:{{ zj_image_tag }}
docker pull {{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ zj_image_tag }}
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
loop_var: zj_image_tag
@ -61,7 +57,7 @@
- name: Locally tag for changes so push works later
command: >-
docker tag
{{ temp_registry.host }}:{{ temp_registry.port }}/{{ _repopath }}:{{ zj_image_tag }}
{{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ zj_image_tag }}
{{ zj_image.repository }}:change_{{ zuul.change }}_{{ zj_image_tag }}
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:
@ -71,7 +67,7 @@
- name: Locally tag for changes so push works later
command: >-
docker tag
{{ temp_registry.host }}:{{ temp_registry.port }}/{{ _repopath }}:{{ zj_image_tag }}
{{ temp_registry.host }}:{{ temp_registry.port }}/{{ zj_image.repository }}:{{ zj_image_tag }}
{{ zj_image.repository }}:{{ zj_image_tag }}
loop: "{{ zj_image.tags | default(['latest']) }}"
loop_control:

View File

@ -3,13 +3,13 @@
- name: Set docker_registry cacheable facts
set_fact:
cacheable: true
docker_registry: "127.0.0.1:5200"
docker_registry: "localhost"
docker_credentials:
username: zuul
password: testpassword
repository: testrepo
container_registry_credentials:
127.0.0.1:5200:
localhost:
username: zuul
password: testpassword
repository: testrepo
@ -37,7 +37,7 @@
dest: /etc/containers/registries.conf
content: |
[registries.insecure]
registries = ['127.0.0.1:5200']
registries = ['localhost']
mode: 0644
when: container_command == 'podman'
@ -46,7 +46,7 @@
vars:
registry:
host: "127.0.0.1"
port: 5200
port: 80
username: zuul
password: testpassword
container_command: docker

View File

@ -13,15 +13,15 @@
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
_multiarch_container_images:
- context: test-playbooks/container/docker
registry: 127.0.0.1:5200
repository: 127.0.0.1:5200/testrepo
registry: localhost
repository: localhost/testrepo
# This is what the Zuul repo uses to tag its releases:
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
arch: ['linux/amd64', 'linux/arm64']
_normal_container_images:
- context: test-playbooks/container/docker
registry: 127.0.0.1:5200
repository: 127.0.0.1:5200/testrepo
registry: localhost
repository: localhost/testrepo
# This is what the Zuul repo uses to tag its releases:
tags: "{{ zuul.tag is defined | ternary([zuul.get('tag', '').split('.')[0], '.'.join(zuul.get('tag', '').split('.')[:2]), zuul.get('tag', '')], ['latest']) }}"
tasks: