diff --git a/roles/build-container-image/tasks/buildx.yaml b/roles/build-container-image/tasks/buildx.yaml index 9c90de89b..17769e52b 100644 --- a/roles/build-container-image/tasks/buildx.yaml +++ b/roles/build-container-image/tasks/buildx.yaml @@ -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: diff --git a/test-playbooks/container/test-build-container-image-pre.yaml b/test-playbooks/container/test-build-container-image-pre.yaml index 49b154ecb..6a4894ea5 100644 --- a/test-playbooks/container/test-build-container-image-pre.yaml +++ b/test-playbooks/container/test-build-container-image-pre.yaml @@ -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 diff --git a/test-playbooks/container/test-build-container-image.yaml b/test-playbooks/container/test-build-container-image.yaml index 9f5fcf576..b0170c978 100644 --- a/test-playbooks/container/test-build-container-image.yaml +++ b/test-playbooks/container/test-build-container-image.yaml @@ -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: