Merge "Modify build-containers role to allow for internal builds"

This commit is contained in:
Zuul 2020-04-23 01:14:06 +00:00 committed by Gerrit Code Review
commit d8b3c202c7
9 changed files with 60 additions and 11 deletions

View File

@ -19,3 +19,4 @@ container_cli_opt: ""
# component_ci_containers used by component-ci jobs to build e.g. nova only
# used together with component_ci_configs in vars/main
component_ci_containers: ""
openstack_git_root: "{{ ansible_user_dir }}/src/opendev.org/openstack"

View File

@ -73,7 +73,9 @@
# fail.
- name: Add dummy epel and epel-module repository
become: true
when: ansible_pkg_mgr == "dnf" and ansible_distribution|lower == "redhat"
when:
- ansible_pkg_mgr == "dnf"
- ansible_distribution|lower == "redhat"
yum_repository:
name: "{{ item }}"
description: Dummy epel repository
@ -85,7 +87,10 @@
- epel-modular
- name: grab kolla patch rhel8
when: ansible_pkg_mgr == "dnf" and ansible_distribution|lower == "redhat"
when:
- ansible_pkg_mgr == "dnf"
- ansible_distribution|lower == "redhat"
- zuul_internal is undefined
shell: |
set -euxo pipefail
git config --global user.email "zuul@openstack.org"
@ -162,13 +167,23 @@
become: true
shell:
cmd: |
{% if zuul_internal is defined %}
cp /etc/yum.repos.d/* /tmp/base-build/repos/
{% else %}
cp /etc/yum.repos.d/delorean* /tmp/base-build/repos/
{% endif %}
chown -R {{ ansible_user }}: /tmp/base-build/repos/*
changed_when: true
- name: render dockerfile
- name: render dockerfile rhui
when: zuul_internal is undefined
template:
src: templates/Dockerfile.j2
src: templates/Dockerfile_rhui.j2
dest: /tmp/base-build/Dockerfile
- name: render dockerfile zuul_internal
when: zuul_internal is defined
template:
src: templates/Dockerfile_redhat.j2
dest: /tmp/base-build/Dockerfile
- name: create base container with repos from rhel container

View File

@ -5,6 +5,7 @@
extra_args: --user
- name: Install deps from upper-constraints
when: zuul_internal is undefined
pip:
extra_args: "-c {{ openstack_git_root }}/requirements/upper-constraints.txt"
requirements: "{{ openstack_git_root }}/{{ item }}/requirements.txt"
@ -15,11 +16,22 @@
- tripleo-common
- python-tripleoclient
- name: Install deps from requirements
when: zuul_internal is defined
pip:
requirements: "{{ openstack_git_root }}/{{ item }}/requirements.txt"
virtualenv: "{{ workspace }}/venv_build"
virtualenv_python: "{{ virtualenv_python[ansible_distribution_major_version|int] }}"
with_items:
- kolla
- openstack-tripleo-common
- python-tripleoclient
- name: Installation from source
pip:
name:
- "file://{{ openstack_git_root }}/kolla"
- "file://{{ openstack_git_root }}/tripleo-common"
- "file://{{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common"
- "file://{{ openstack_git_root }}/python-tripleoclient"
- decorator
virtualenv: "{{ workspace }}/venv_build"
@ -27,4 +39,5 @@
- name: set template override
set_fact:
kolla_override_path: "{{ openstack_git_root }}/tripleo-common/container-images/tripleo_kolla_template_overrides.j2"
kolla_override_path:
"{{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common/container-images/tripleo_kolla_template_overrides.j2"

View File

@ -0,0 +1,4 @@
FROM {{ base_ubi_image }}:{{ base_ubi_tag }}
RUN rm -f /etc/yum.repos.d/delorean*
COPY repos/* /etc/yum.repos.d/.
RUN dnf clean all

View File

@ -3,8 +3,9 @@
source {{ workspace }}/venv_build/bin/activate
pip install -U decorator
{% endif %}
TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/tripleo-common"
TRIPLEO_CI_PATH="{{ openstack_git_root }}/tripleo-ci"
TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/{% if zuul_internal is defined %}openstack-{% endif %}tripleo-common"
TRIPLEO_CI_PATH="{{ ansible_user_dir }}/src/opendev.org/openstack/tripleo-ci"
### list containers to build
openstack overcloud container image build {{ container_config }}\
@ -52,7 +53,7 @@ done
egrep "^Error:|No match" /tmp/kolla-*/docker -R > containers-build-errors.log 2>&1
### actual built containers
sudo {{ container_cli }} images | grep {{ kolla_base }}-binary > containers-successfully-built.log
sudo {{ container_cli }} images | grep tripleo{% if osp_branch is defined %}{{ osp_branch }}{% else %}{{ ci_branch }}{% endif %}/{{ kolla_base }}-binary > containers-successfully-built.log
### not built (failed)
for i in `cat containers-expected-to-build.log`; do

View File

@ -12,5 +12,9 @@ template_override={{ kolla_override_path }}
rpm_setup_config="{{ buildcontainers_rpm_setup_config }}"
push={{ push_containers }}
pull={{ kolla_base_pull }}
{% if osp_branch is defined %}
namespace=tripleo{{ osp_branch }}
{% else %}
namespace=tripleo{{ ci_branch }}
{% endif %}
debug=True

View File

@ -1,5 +1,4 @@
workspace: "{{ ansible_user_dir }}/workspace"
openstack_git_root: "{{ ansible_user_dir }}/src/opendev.org/openstack"
# https://review.opendev.org/#/c/669471 - rhel8 kolla support
kolla_rhel8_patch:

View File

@ -376,6 +376,18 @@
extra_tags:
- standalone-upgrade
- job:
name: tripleo-build-containers-base-noreposetup-rhel8
abstract: true
description: |
Base abstract job for rhel8 TripleO CI build-containers jobs
in particular no required-projects
parent: tripleo-ci-base-singlenode
run: playbooks/tripleo-buildcontainers/run.yaml
post-run: playbooks/tripleo-buildcontainers/post.yaml
timeout: 7200
voting: false
# Please do not add files: to tripleo-build-containers-base otherwise the periodic job wont run
# See https://storyboard.openstack.org/#!/story/2005040
- job: