From bc278516174cd1133ca910bb4978397499645a34 Mon Sep 17 00:00:00 2001 From: Marios Andreou Date: Wed, 17 Nov 2021 13:26:06 +0200 Subject: [PATCH] Use repo-setup role and tripleo-quickstart config for C9 images Adds a new role tripleo-build-jobs-repos that is used by container and image build pre playbooks to setup repos with the repo-setup role for Centos9. Depends-On 817161 modifies the release files to use the c9 stream repos and carries workaround until a better fix is merged like [1] or similar. [1] https://review.opendev.org/c/opendev/base-jobs/+/820018 Depends-On: https://review.opendev.org/c/openstack/tripleo-quickstart/+/817161 Change-Id: I39fc32cf1249b4f14bdc35a4af7a1f8784c19801 --- .ansible-lint | 1 + playbooks/tripleo-buildcontainers/pre.yaml | 15 ++--- playbooks/tripleo-buildcontainers/pre9.yaml | 35 ----------- playbooks/tripleo-buildimages/pre.yaml | 8 ++- playbooks/tripleo-buildimages/pre9.yaml | 21 ------- roles/oooci-build-images/vars/centos-9.yaml | 2 +- .../tripleo-build-jobs-repos/tasks/main.yaml | 62 +++++++++++++++++++ 7 files changed, 77 insertions(+), 67 deletions(-) delete mode 100644 playbooks/tripleo-buildcontainers/pre9.yaml delete mode 100644 playbooks/tripleo-buildimages/pre9.yaml create mode 100644 roles/tripleo-build-jobs-repos/tasks/main.yaml diff --git a/.ansible-lint b/.ansible-lint index c5d113755..a7c9dc583 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,6 +7,7 @@ skip_list: - empty-string-compare # https://github.com/ansible/ansible-lint/issues/457 - role-name # Role name run-test does not match ``^[a-z][a-z0-9_]+$`` pattern - risky-file-permissions # File permissions unset or incorrect + - package-latest verbosity: 1 mock_modules: - zuul_return diff --git a/playbooks/tripleo-buildcontainers/pre.yaml b/playbooks/tripleo-buildcontainers/pre.yaml index dd638eae6..4107633c5 100644 --- a/playbooks/tripleo-buildcontainers/pre.yaml +++ b/playbooks/tripleo-buildcontainers/pre.yaml @@ -59,11 +59,12 @@ vars: bindep_dir: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/python-tripleoclient'].src_dir }}" - - name: Run build containers pre tasks - include_role: - name: build-containers - tasks_from: pre + - name: Setup repos using repo-setup role and release file + when: ansible_distribution_major_version is version(9, '>=') + include_role: + name: tripleo-build-jobs-repos - - name: Container Build for 9 specific distros - when: ansible_distribution_major_version is version(9, '==') - include: pre9.yaml + - name: Run build containers pre tasks + include_role: + name: build-containers + tasks_from: pre diff --git a/playbooks/tripleo-buildcontainers/pre9.yaml b/playbooks/tripleo-buildcontainers/pre9.yaml deleted file mode 100644 index f317fe3df..000000000 --- a/playbooks/tripleo-buildcontainers/pre9.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -# It contains RHEL9 specific tasks -- name: get extra repos delorean and deps - become: true - shell: - cmd: | - dnf config-manager --add-repo {{ item }} - loop: - - "https://trunk.rdoproject.org/centos9-master/{{ promote_source | default('consistent') }}/delorean.repo" - - https://trunk.rdoproject.org/centos9-master/delorean-deps.repo - changed_when: true - -- name: Install vitualenv - become: true - package: - name: python3-virtualenv - state: latest - -- name: Include tripleo-repos - include_role: - name: tripleo-repos - vars: - override_repos: "{{ buildcontainers_override_repos | default('') }}" - tripleo_repos_repository: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-repos'].src_dir }}" - -- name: Install python3-tripleoclient - become: true - package: - name: python3-tripleoclient - state: latest - -- name: Run build containers pre tasks - include_role: - name: build-containers - tasks_from: pre diff --git a/playbooks/tripleo-buildimages/pre.yaml b/playbooks/tripleo-buildimages/pre.yaml index 3097ee7b3..e00568346 100644 --- a/playbooks/tripleo-buildimages/pre.yaml +++ b/playbooks/tripleo-buildimages/pre.yaml @@ -19,11 +19,13 @@ when: - ansible_pkg_mgr == "yum" - - name: Include EL9 taks - when: ansible_distribution_major_version is version(9, '==') - include: pre9.yaml + - name: Setup repos using repo-setup role and release file + when: ansible_distribution_major_version is version(9, '>=') + include_role: + name: tripleo-build-jobs-repos - name: Include tripleo-repos + when: ansible_distribution_major_version is version(8, '<=') include_role: name: tripleo-repos vars: diff --git a/playbooks/tripleo-buildimages/pre9.yaml b/playbooks/tripleo-buildimages/pre9.yaml deleted file mode 100644 index a0f3e2c96..000000000 --- a/playbooks/tripleo-buildimages/pre9.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Set the ci_branch fact - include_role: - name: build-containers - tasks_from: set_ci_branch.yml - -- name: get extra repos delorean and deps - become: true - shell: - cmd: | - dnf config-manager --add-repo {{ item }} - loop: - - "https://trunk.rdoproject.org/centos9-{{ ci_branch }}/{{ promote_source | default('current-tripleo') }}/delorean.repo" - - https://trunk.rdoproject.org/centos9-{{ ci_branch }}/delorean-deps.repo - changed_when: true - -- name: Install vitualenv - become: true - package: - name: python3-virtualenv - state: latest diff --git a/roles/oooci-build-images/vars/centos-9.yaml b/roles/oooci-build-images/vars/centos-9.yaml index e692835a3..904e4a1a1 100644 --- a/roles/oooci-build-images/vars/centos-9.yaml +++ b/roles/oooci-build-images/vars/centos-9.yaml @@ -1,7 +1,7 @@ --- tripleo_image_source: https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20210830.0.x86_64.qcow2 dib_yum_repo_conf: - - /etc/yum.repos.d/CentOS-Stream-9-* + - /etc/yum.repos.d/quickstart-centos* - /etc/yum.repos.d/delorean* dib_release: "9" dib_dnf_module_streams: "" diff --git a/roles/tripleo-build-jobs-repos/tasks/main.yaml b/roles/tripleo-build-jobs-repos/tasks/main.yaml new file mode 100644 index 000000000..610f4110b --- /dev/null +++ b/roles/tripleo-build-jobs-repos/tasks/main.yaml @@ -0,0 +1,62 @@ +--- +- name: Set the ci_branch fact + include_role: + name: build-containers + tasks_from: set_ci_branch + +- name: Get ci-common-vars + include_role: + name: ci-common-vars + +- name: Set facts for release_file_name + set_fact: + release_file_name: "{{ 'promotion-testing-hash-' + ci_branch + '.yml' if 'periodic' in zuul.job else ci_branch + '.yml' }}" + t_q_release_dir: "{{ tripleo_quickstart_dir }}/config/release/tripleo-ci/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}" + whole_disk_images: true + enable_opstools_repo: true # for collectd container build + +- name: "fetch {{ release_file_name }} into ansible executor work_root" + fetch: + src: "{{ t_q_release_dir }}/{{ release_file_name }}" + dest: "{{ zuul.executor.work_root }}/" + flat: true + +- name: Load vars from release file + include_vars: + file: "{{ zuul.executor.work_root }}/{{ release_file_name }}" + +- name: Remove pip package if already installed + become: true + package: + name: python3-pip + state: absent + +- name: Get pip needed for tripleo-repos installation + include_role: + name: ensure-pip + vars: + ensure_pip_from_packages: false + ensure_pip_from_upstream: true + +- name: install tripleo-repos from git checkout + shell: | + pushd "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/tripleo-repos'].src_dir }}" + python setup.py install --user + popd + failed_when: false + changed_when: true + +- name: Include repo-setup role + include_role: + name: repo-setup + vars: + repo_setup_dir: "{{ workspace }}" + repo_setup_use_collections: false + +- name: Install python3-tripleoclient python3-virtualenv + become: true + package: + name: + - python3-virtualenv + - python3-tripleoclient + state: latest