tripleo-ci/roles/tripleo-repos/tasks/main.yml
Sandeep Yadav b0747d54d2 Exclude buggy edk2-ovmf for t/u/v container-build
c8-stream currently contains two versions of edk2-ovmf, We are
excluding edk2-ovmf-20200602gitca407c7246bf-5 so we use the
lower version edk2-ovmf-20200602gitca407c7246bf-4.el8

This is recommended from compute team that we keep using old version
until bz1961562 [2] is fixed. Fix will come in libvirt[2].

We fixed the check job using [3]. Periodic container build job don't
utilize repos from tripleo-quickstart release file, AppStream.repo
seems coming from configure-mirrors[4] role.

Creating a task here to include the exclude for buggy edk2-ovmf
version.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1961562
[2] 61d95a1073
[3] https://review.opendev.org/c/openstack/tripleo-quickstart/+/793098
[4] https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/configure-mirrors/tasks/mirror/CentOSStream-8.yaml#L10

Closes-Bug: #1929634
Change-Id: I843aee754b29a49ec5a2c88af1bda7bce7a60aee
2021-06-01 00:03:19 +05:30

142 lines
4.2 KiB
YAML

---
- name: Install and enable epel (centos7/rhel7)
block:
- name: Install epel-release
package:
name: epel-release
state: present
- name: Ensure EPEL repo is enabled
ini_file:
dest: /etc/yum.repos.d/epel.repo
section: epel
option: enabled
value: '1'
become: true
when: ansible_distribution_major_version|int == 7
- name: install system packages
become: true
package:
name: "{{ rpm_packages }}"
state: present
- name: pip install tripleo-repos
become: true
pip:
name: "{{ tripleo_repos_repository }}"
virtualenv: "{{ workspace }}/venv"
# https://github.com/ansible/ansible/issues/52275
virtualenv_command: "/usr/bin/python3 -m venv"
virtualenv_site_packages: true
# NOTE(rfolco): we need to set both virtualenv_command and
# ansible_python_interpreter, otherwise we hit this error:
# Failed to import the required Python library (setuptools)
# This happens in a dual python env like centos7.8
vars:
ansible_python_interpreter: /usr/bin/python3
- name: Disable epel (centos7/rhel7)
block:
- name: Ensure EPEL repo is disabled
ini_file:
dest: /etc/yum.repos.d/epel.repo
section: epel
option: enabled
value: '0'
become: true
when: ansible_distribution_major_version|int == 7
- name: Set branch for building containers check jobs
set_fact:
ci_branch: "{{ zuul.branch | regex_replace('(stable|cloudsig)/', '') }}"
when: zuul is defined
- name: Set branch for building containers branchless
set_fact:
ci_branch: "{{ branch_override | regex_replace('(stable|cloudsig)/', '') }}"
when: branch_override is defined
- name: Set branch for building containers periodic
set_fact:
ci_branch: "{{ release }}"
when: release is defined
- name: Get /etc/os-release name
shell: 'source /etc/os-release && echo -e -n "$NAME"'
register: os_name_output
- name: Set stream false
set_fact:
is_stream_node: false
- name: Set stream true if stream node
set_fact:
is_stream_node: true
when: "os_name_output.stdout_lines[0]| regex_search('(S|s)tream$')"
# Remove this task once rh bz 1961562 is fixed.
- name: Add edk2 on exclude list for AppStream repo
become: true
lineinfile:
path: /etc/yum.repos.d/CentOS-Stream-AppStream.repo
line: 'exclude=edk2-ovmf-20200602gitca407c7246bf-5*'
insertafter: EOF
when: release is defined and release in ['train', 'ussuri', 'victoria']
- name: Install repos
become: true
shell: |
set -exo pipefail
source {{ workspace }}/venv/bin/activate
if [ -f /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
DISTRO_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}"
fi
{% if ansible_distribution | lower == 'fedora' %}
DISTRO_MIRROR_HOST=${DISTRO_MIRROR_HOST:-"{{ fedora_mirror_host }}"}
{% elif ansible_distribution | lower == 'centos' %}
DISTRO_MIRROR_HOST=${DISTRO_MIRROR_HOST:-"{{ centos_mirror_host }}"}
{% endif %}
RDO_MIRROR_HOST=${NODEPOOL_RDO_PROXY:-"{{ rdo_mirror_host }}"}
if [ "{{ override_repos }}" != "" ]; then
REPO="{{ override_repos }}"
elif [ "{{ ci_branch | default('master') }}" == "master" ]; then
REPO=current-tripleo
else
REPO=current
fi
if [ ! -z "$DISTRO_MIRROR_HOST" ]; then
MIRROR="--mirror $DISTRO_MIRROR_HOST"
# Workaround for setting nodepool centos mirror for delorean-deps
# check launchpad tripleo/+bug/1922032
else
MIRROR="--mirror http://mirror.regionone.vexxhost.rdoproject.org/centos"
fi
if [ "{{ is_stream_node|string }}" == "True" ]; then
tripleo-repos \
-b "{{ ci_branch | default('master') }}" \
$MIRROR \
--rdo-mirror $RDO_MIRROR_HOST $REPO ceph opstools \
--stream
else
tripleo-repos \
-b "{{ ci_branch | default('master') }}" \
$MIRROR \
--rdo-mirror $RDO_MIRROR_HOST $REPO ceph opstools \
--no-stream
fi
register: result
changed_when: "'Installed:' in result.stdout_lines"
args:
warn: false
- name: Update all installed packages after new repos are setup # noqa package-latest
become: true
package:
name: '*'
state: latest