loci/playbooks/build.yaml
Vladimir Kozhukalov a7e69684b4 Use *-container-image roles
Instead of using *-docker-image roles for
building and uploading images let's use
*-container-image roles which allow upload
images to OCI compatible registries (not only docker hub).

Change-Id: I706045d465de6217c82632148bdaf3b0eb4f6d95
2024-12-05 17:39:19 -06:00

80 lines
2.3 KiB
YAML

---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- hosts: all[0]
gather_facts: true
roles:
- use-buildset-registry
tasks:
- name: Vars
include_vars:
file: "vars.yaml"
- name: Job vars
include_vars:
file: "{{ item }}"
loop: "{{ vars_files }}"
- name: Ensure dep files are sorted
shell: "grep -v '^#' ./{{ item }} | sort --check"
loop:
- "bindep.txt"
- "pydep.txt"
environment:
LC_ALL: C
- name: Build base image
include_role:
name: build-container-image
vars:
container_images:
- "{{ base_image }}"
- name: Build requirements image
include_role:
name: build-container-image
vars:
container_images:
- "{{ requirements_image }}"
loop_control:
loop_var: image_registry
loop: "{{ image_registries }}"
- name: Tag requirements image and push to local registry
shell: |
for tag in {{ requirements_image.tags | join(" ") }}; do
docker tag {{ requirements_image.repository }}:$tag {{ local_registry }}/{{ requirements_image.repository }}:$tag
docker push {{ local_registry }}/{{ requirements_image.repository }}:$tag
done
loop_control:
loop_var: image_registry
loop: "{{ image_registries }}"
- name: Build project images
include_role:
name: build-container-image
vars:
container_images: "{{ openstack_images }}"
loop_control:
loop_var: image_registry
loop: "{{ image_registries }}"
- name: Return images to zuul
include_tasks: _return-image.yml
loop: "{{ openstack_images }}"
loop_control:
loop_var: zj_image
vars:
image_registry: "{{ image_registries[0] }}"