[WIP] Refactor Openstack image build

Change-Id: I7c63ee98125bf0988b3926e40dd916087cbb9476
This commit is contained in:
Vladimir Kozhukalov 2024-04-27 00:26:16 -05:00
parent 9c19b92dea
commit c0da28610d
5 changed files with 140 additions and 88 deletions

View File

@ -56,9 +56,9 @@
- openstack-helm-images-compute-kit-2023-1-ubuntu_jammy - openstack-helm-images-compute-kit-2023-1-ubuntu_jammy
- openstack-helm-images-cinder-2023-1-ubuntu_jammy - openstack-helm-images-cinder-2023-1-ubuntu_jammy
- openstack-helm-images-horizon-2023-1-ubuntu_jammy - openstack-helm-images-horizon-2023-1-ubuntu_jammy
templates: # templates:
- publish-openstack-docs-pti # - publish-openstack-docs-pti
- release-notes-jobs-python3 # - release-notes-jobs-python3
# This takes the same structure as other infra jobs. # This takes the same structure as other infra jobs.
# This dict keyname matter. See also job definition for more explanations. # This dict keyname matter. See also job definition for more explanations.
@ -92,7 +92,7 @@
name: openstack-helm-images-buildset-registry name: openstack-helm-images-buildset-registry
parent: opendev-buildset-registry parent: opendev-buildset-registry
timeout: 10800 timeout: 10800
voting: false # voting: false
# In docker_images: # In docker_images:
# `context` is the folder in osh-images # `context` is the folder in osh-images

View File

@ -11,29 +11,29 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- project: # - project:
check: # check:
jobs: # jobs:
- openstack-helm-images-build-openstack-2023-2-ubuntu_jammy # - openstack-helm-images-build-openstack-2023-2-ubuntu_jammy
- openstack-helm-images-compute-kit-2023-2-ubuntu_jammy # - openstack-helm-images-compute-kit-2023-2-ubuntu_jammy
- openstack-helm-images-cinder-2023-2-ubuntu_jammy # - openstack-helm-images-cinder-2023-2-ubuntu_jammy
gate: # gate:
jobs: # jobs:
- openstack-helm-images-upload-openstack-2023-2-ubuntu_jammy # - openstack-helm-images-upload-openstack-2023-2-ubuntu_jammy
- openstack-helm-images-compute-kit-2023-2-ubuntu_jammy # - openstack-helm-images-compute-kit-2023-2-ubuntu_jammy
- openstack-helm-images-cinder-2023-2-ubuntu_jammy # - openstack-helm-images-cinder-2023-2-ubuntu_jammy
promote: # promote:
jobs: # jobs:
- openstack-helm-images-promote-openstack-2023-2-ubuntu_jammy # - openstack-helm-images-promote-openstack-2023-2-ubuntu_jammy
periodic-weekly: # periodic-weekly:
jobs: # jobs:
- openstack-helm-images-upload-openstack-2023-2-ubuntu_jammy # - openstack-helm-images-upload-openstack-2023-2-ubuntu_jammy
- openstack-helm-images-promote-openstack-2023-2-ubuntu_jammy: # - openstack-helm-images-promote-openstack-2023-2-ubuntu_jammy:
dependencies: # dependencies:
- name: openstack-helm-images-compute-kit-2023-2-ubuntu_jammy # - name: openstack-helm-images-compute-kit-2023-2-ubuntu_jammy
- name: openstack-helm-images-cinder-2023-2-ubuntu_jammy # - name: openstack-helm-images-cinder-2023-2-ubuntu_jammy
- openstack-helm-images-compute-kit-2023-2-ubuntu_jammy # - openstack-helm-images-compute-kit-2023-2-ubuntu_jammy
- openstack-helm-images-cinder-2023-2-ubuntu_jammy # - openstack-helm-images-cinder-2023-2-ubuntu_jammy
- job: - job:
name: openstack-helm-images-build-openstack-2023-2-ubuntu_jammy name: openstack-helm-images-build-openstack-2023-2-ubuntu_jammy

View File

@ -44,25 +44,25 @@
vars: &build_vars vars: &build_vars
branchname: "stable/2024.1" branchname: "stable/2024.1"
shortbranchname: "2024.1" shortbranchname: "2024.1"
openstack_docker_images: openstack_docker_images: []
- requirements # - requirements
- keystone # - keystone
- glance # - glance
- cinder # - cinder
- designate # - designate
- nova # - nova
- ironic # - ironic
- neutron # - neutron
- horizon # - horizon
- heat # - heat
- barbican # - barbican
- placement # - placement
- cyborg # - cyborg
- magnum # - magnum
- masakari # - masakari
- masakari_monitors # - masakari_monitors
- manila # - manila
- tacker # - tacker
files: &openstack_files files: &openstack_files
- ^openstack/loci/.* - ^openstack/loci/.*
- zuul.d/openstack-2024.1.yaml - zuul.d/openstack-2024.1.yaml

View File

@ -0,0 +1,52 @@
---
# 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
vars_files:
- vars-openstack.yml
pre_tasks:
- name: Use buildset registry
include_role:
name: use-buildset-registry
tasks:
- name: Export the right vars
shell: |
source /etc/ci/mirror_info.sh
echo ${NODEPOOL_PYPI_MIRROR}
echo ${NODEPOOL_MIRROR_HOST}
args:
executable: /bin/bash
changed_when: False
register: _zuul_mirrors
- name: Set fact with the exported variables
set_fact:
pip_index_url: "{{ _zuul_mirrors.stdout_lines[0] | default('https://pypi.python.org/simple/') }}"
pip_trusted_host: "{{ _zuul_mirrors.stdout_lines[1] | default('pypi.python.org') }}"
- name: Build base image
include_role:
name: build-docker-image
vars:
zuul_work_dir: "{{ zuul.project.src_dir }}"
docker_images: "{{ base_docker_images }}"
- name: Build requirements image
include_role:
name: build-docker-image
vars:
zuul_work_dir: "src/opendev.org/openstack/loci"
docker_images: "{{ requirements_docker_images }}"

View File

@ -22,21 +22,21 @@
include_role: include_role:
name: use-buildset-registry name: use-buildset-registry
tasks: tasks:
- name: Export the right vars # - name: Export the right vars
shell: | # shell: |
source /etc/ci/mirror_info.sh # source /etc/ci/mirror_info.sh
echo ${NODEPOOL_OPENSUSE_MIRROR}/ # echo ${NODEPOOL_OPENSUSE_MIRROR}/
echo ${NODEPOOL_PYPI_MIRROR} # echo ${NODEPOOL_PYPI_MIRROR}
echo ${NODEPOOL_MIRROR_HOST} # echo ${NODEPOOL_MIRROR_HOST}
args: # args:
executable: /bin/bash # executable: /bin/bash
changed_when: False # changed_when: False
register: _zuul_mirrors # register: _zuul_mirrors
- name: Set fact with the exported variables # - name: Set fact with the exported variables
set_fact: # set_fact:
opensuse_package_mirror: "{{ _zuul_mirrors.stdout_lines[0] }}" # opensuse_package_mirror: "{{ _zuul_mirrors.stdout_lines[0] }}"
pip_index_url: "{{ _zuul_mirrors.stdout_lines[1] | default('https://pypi.python.org/simple/') }}" # pip_index_url: "{{ _zuul_mirrors.stdout_lines[1] | default('https://pypi.python.org/simple/') }}"
pip_trusted_host: "{{ _zuul_mirrors.stdout_lines[2] | default('pypi.python.org') }}" # pip_trusted_host: "{{ _zuul_mirrors.stdout_lines[2] | default('pypi.python.org') }}"
- name: Build base image - name: Build base image
include_role: include_role:
@ -52,34 +52,34 @@
zuul_work_dir: "src/opendev.org/openstack/loci" zuul_work_dir: "src/opendev.org/openstack/loci"
docker_images: "{{ requirements_docker_images }}" docker_images: "{{ requirements_docker_images }}"
- name: Build webserver serving wheels # - name: Build webserver serving wheels
include_role: # include_role:
name: build-docker-image # name: build-docker-image
vars: # vars:
zuul_work_dir: "{{ zuul.project.src_dir }}" # zuul_work_dir: "{{ zuul.project.src_dir }}"
docker_images: # docker_images:
- context: zuul.d/playbooks/ # - context: zuul.d/playbooks/
repository: openstackhelm/loci_wheels # repository: openstackhelm/loci_wheels
- name: Allow access to wheels server # - name: Allow access to wheels server
iptables: # iptables:
action: insert # action: insert
chain: INPUT # chain: INPUT
in_interface: docker0 # in_interface: docker0
jump: ACCEPT # jump: ACCEPT
become: yes # become: yes
- name: Run http server containing wheels # - name: Run http server containing wheels
command: docker run -d -p 0.0.0.0:8080:80 openstackhelm/loci_wheels:latest # command: docker run -d -p 0.0.0.0:8080:80 openstackhelm/loci_wheels:latest
- name: Build project images # - name: Build project images
include_role: # include_role:
name: build-docker-image # name: build-docker-image
vars: # vars:
zuul_work_dir: "src/opendev.org/openstack/loci" # zuul_work_dir: "src/opendev.org/openstack/loci"
- name: Return images to zuul # - name: Return images to zuul
include_tasks: _return-image.yml # include_tasks: _return-image.yml
loop: "{{ docker_images }}" # loop: "{{ docker_images }}"
loop_control: # loop_control:
loop_var: zj_image # loop_var: zj_image