[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 cd04e610a4
6 changed files with 159 additions and 163 deletions

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

@ -15,14 +15,11 @@
- project: - project:
check: check:
jobs: jobs:
- openstack-helm-images-build-openstack-2024-1-ubuntu_jammy - openstack-helm-images-build-openstack-base-2024-1-ubuntu_jammy
# - openstack-helm-images-compute-kit-2024-1-ubuntu_jammy # - openstack-helm-images-build-openstack-2024-1-ubuntu_jammy
# - openstack-helm-images-cinder-2024-1-ubuntu_jammy
gate: gate:
jobs: jobs:
- openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy - openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy
# - openstack-helm-images-compute-kit-2024-1-ubuntu_jammy
# - openstack-helm-images-cinder-2024-1-ubuntu_jammy
promote: promote:
jobs: jobs:
- openstack-helm-images-promote-openstack-2024-1-ubuntu_jammy - openstack-helm-images-promote-openstack-2024-1-ubuntu_jammy
@ -32,37 +29,45 @@
- openstack-helm-images-promote-openstack-2024-1-ubuntu_jammy: - openstack-helm-images-promote-openstack-2024-1-ubuntu_jammy:
dependencies: dependencies:
- name: openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy - name: openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy
# - name: openstack-helm-images-compute-kit-2024-1-ubuntu_jammy
# - name: openstack-helm-images-cinder-2024-1-ubuntu_jammy - job:
# - openstack-helm-images-compute-kit-2024-1-ubuntu_jammy name: openstack-helm-images-build-openstack-base-2024-1-ubuntu_jammy
# - openstack-helm-images-cinder-2024-1-ubuntu_jammy description: Build base 2024.1 Jammy images
parent: openstack-helm-images-build-openstack-ubuntu_jammy
vars:
branchname: "stable/2024.1"
shortbranchname: "2024.1"
run:
- zuul.d/playbooks/build-openstack-base.yml
- job: - job:
name: openstack-helm-images-build-openstack-2024-1-ubuntu_jammy name: openstack-helm-images-build-openstack-2024-1-ubuntu_jammy
description: Build 2024.1 Jammy images description: Build 2024.1 Jammy images
parent: openstack-helm-images-build-openstack-ubuntu_jammy parent: openstack-helm-images-build-openstack-ubuntu_jammy
dependencies:
- openstack-helm-images-build-openstack-base-2024-1-ubuntu_jammy
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
@ -85,58 +90,3 @@
vars: *build_vars vars: *build_vars
files: *openstack_files files: *openstack_files
- job:
name: openstack-helm-images-compute-kit-2024-1-ubuntu_jammy
parent: openstack-helm-compute-kit-2024-1-ubuntu_jammy
dependencies:
- name: openstack-helm-images-build-openvswitch
soft: true
- name: openstack-helm-images-build-openstack-2024-1-ubuntu_jammy
soft: true
- name: openstack-helm-images-build-mariadb
soft: true
- name: openstack-helm-images-build-libvirt
soft: true
- name: openstack-helm-images-upload-openvswitch
soft: true
- name: openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy
soft: true
- name: openstack-helm-images-upload-mariadb
soft: true
- name: openstack-helm-images-upload-libvirt
soft: true
files:
- openvswitch/.*
- zuul.d/openvswitch.yaml
- mariadb/.*
- zuul.d/mariadb.yaml
- libvirt/.*
- zuul.d/libvirt.yaml
- ^openstack/loci/.*
- zuul.d/openstack-2024.1.yaml
- zuul.d/openstack-base.yaml
- zuul.d/playbooks/build-openstack.yml
- zuul.d/playbooks/vars-openstack.yml
- zuul.d/playbooks/Dockerfile_base
- job:
name: openstack-helm-images-cinder-2024-1-ubuntu_jammy
parent: openstack-helm-cinder-2024-1-ubuntu_jammy
dependencies:
- name: openstack-helm-images-build-openstack-2024-1-ubuntu_jammy
soft: true
- name: openstack-helm-images-build-mariadb
soft: true
- name: openstack-helm-images-upload-openstack-2024-1-ubuntu_jammy
soft: true
- name: openstack-helm-images-upload-mariadb
soft: true
files:
- mariadb/.*
- zuul.d/mariadb.yaml
- ^openstack/loci/.*
- zuul.d/openstack-2024.1.yaml
- zuul.d/openstack-base.yaml
- zuul.d/playbooks/build-openstack.yml
- zuul.d/playbooks/vars-openstack.yml
- zuul.d/playbooks/Dockerfile_base

View File

@ -28,7 +28,7 @@
ceph_repo: "" ceph_repo: ""
ceph_key: "" ceph_key: ""
openstack_docker_images: openstack_docker_images:
- requirements # - requirements
- keystone - keystone
- glance - glance
- cinder - cinder

View File

@ -0,0 +1,37 @@
---
# 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: 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

@ -17,60 +17,62 @@
- vars-openstack.yml - vars-openstack.yml
vars: vars:
docker_images: "{{ openstack_docker_images | map('extract', openstack_docker_images_dict) | list }}" docker_images: "{{ openstack_docker_images | map('extract', openstack_docker_images_dict) | list }}"
wheels_location: "{{ buildset_registry_alias }}/requirements:{{ shortbranchname }}-{{ distroname }}"
pre_tasks: pre_tasks:
- name: Use buildset registry - name: Use buildset registry
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_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
set_fact:
opensuse_package_mirror: "{{ _zuul_mirrors.stdout_lines[0] }}"
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') }}"
- name: Build base image # - name: Set fact with the exported variables
include_role: # set_fact:
name: build-docker-image # pip_index_url: "{{ _zuul_mirrors.stdout_lines[0] | default('https://pypi.python.org/simple/') }}"
vars: # pip_trusted_host: "{{ _zuul_mirrors.stdout_lines[1] | default('pypi.python.org') }}"
zuul_work_dir: "{{ zuul.project.src_dir }}"
docker_images: "{{ base_docker_images }}"
- name: Build base requirements image # - name: Build base image
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: "{{ zuul.project.src_dir }}"
docker_images: "{{ requirements_docker_images }}" # docker_images: "{{ base_docker_images }}"
- name: Build webserver serving wheels # - name: Build requirements image
include_role: # include_role:
name: build-docker-image # name: build-docker-image
vars: # vars:
zuul_work_dir: "{{ zuul.project.src_dir }}" # zuul_work_dir: "src/opendev.org/openstack/loci"
docker_images: # docker_images: "{{ requirements_docker_images }}"
- context: zuul.d/playbooks/
repository: openstackhelm/loci_wheels
- name: Allow access to wheels server # - name: Build webserver serving wheels
iptables: # include_role:
action: insert # name: build-docker-image
chain: INPUT # vars:
in_interface: docker0 # zuul_work_dir: "{{ zuul.project.src_dir }}"
jump: ACCEPT # docker_images:
become: yes # - context: zuul.d/playbooks/
# repository: openstackhelm/loci_wheels
- name: Run http server containing wheels # - name: Allow access to wheels server
command: docker run -d -p 0.0.0.0:8080:80 openstackhelm/loci_wheels:latest # iptables:
# action: insert
# chain: INPUT
# in_interface: docker0
# jump: ACCEPT
# become: yes
# - name: Run http server containing wheels
# 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:

View File

@ -14,8 +14,13 @@
currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}" currentdate: "{{ now(utc=True,fmt='%Y%m%d') }}"
python3: "yes" python3: "yes"
#172.17.0.1 is default docker0 ip. #172.17.0.1 is default docker0 ip.
wheels_location: "http://172.17.0.1:8080/wheels.tar.gz" # wheels_location: "http://172.17.0.1:8080/wheels.tar.gz"
# wheels_location: "{{ buildset_registry_alias }}/requirements:{{ shortbranchname }}-{{ distroname }}"
base_repository: "base" base_repository: "base"
requirements_repository: "requirements"
tags: &imagetag
- "{{ shortbranchname }}-{{ distroname }}"
- "{{ shortbranchname }}-{{ distroname }}-{{ currentdate }}"
base_docker_images: base_docker_images:
- context: "zuul.d/playbooks/" - context: "zuul.d/playbooks/"
@ -25,33 +30,35 @@ base_docker_images:
- "FROM='{{ from }}'" - "FROM='{{ from }}'"
- "CEPH_REPO='{{ ceph_repo }}'" - "CEPH_REPO='{{ ceph_repo }}'"
- "CEPH_KEY='{{ ceph_key }}'" - "CEPH_KEY='{{ ceph_key }}'"
tags: *imagetag
requirements_docker_images: requirements_docker_images:
- context: "." - context: "."
repository: openstackhelm/requirements repository: requirements
build_args: build_args:
- "FROM='{{ base_repository }}'" - "FROM='{{ base_repository }}'"
- "PROJECT='requirements'" - "PROJECT='requirements'"
- "PROJECT_REF={{ branchname }}" - "PROJECT_REF={{ branchname }}"
- "KEEP_ALL_WHEELS=yes" - "KEEP_ALL_WHEELS=yes"
tags: *imagetag
openstack_docker_images_dict: openstack_docker_images_dict:
requirements: # requirements:
context: "." # context: "."
repository: openstackhelm/requirements # repository: openstackhelm/requirements
build_args: # build_args:
- "FROM='{{ base_repository }}'" # - "FROM='{{ base_repository }}'"
- "PROJECT='requirements'" # - "PROJECT='requirements'"
- "PROJECT_REF={{ branchname }}" # - "PROJECT_REF={{ branchname }}"
- "KEEP_ALL_WHEELS=yes" # - "KEEP_ALL_WHEELS=yes"
tags: &imagetag # tags: &imagetag
- "{{ shortbranchname }}-{{ distroname }}" # - "{{ shortbranchname }}-{{ distroname }}"
- "{{ shortbranchname }}-{{ distroname }}-{{ currentdate }}" # Frozen tag # - "{{ shortbranchname }}-{{ distroname }}-{{ currentdate }}" # Frozen tag
keystone: keystone:
context: "." context: "."
repository: openstackhelm/keystone repository: openstackhelm/keystone
build_args: build_args:
- "FROM='{{ base_repository }}'" - "FROM='{{ base_repository }}:{{ shortbranchname }}-{{ distroname }}'"
- "PROJECT='keystone'" - "PROJECT='keystone'"
- "PROJECT_REF={{ branchname }}" - "PROJECT_REF={{ branchname }}"
- "PROFILES='fluent apache ldap {{ shortbranchname }}'" - "PROFILES='fluent apache ldap {{ shortbranchname }}'"