tripleo-quickstart-extras/roles/build-test-packages
Jakob Meng ff64ea937c Allow to define artg_change_list variable in zuul jobs
Previously, artg_change_list in role build-test-packages would default
to an empty list if not defined. Now, artg_change_list will default to
job.artg_change_list which itself defaults to empty list. This allows
us to specify variable artg_change_list in Zuul jobs. If role
build-test-packages is executed locally, then a locally defined
artg_change_list still has higher precedence, as expected.

Previously, if a change had e.g. a 'Depends-On:' statement in its
commit message, the artg_change_list variable would be overwritten
with patches defined in the 'Depends-On:' statements. Now, patches
listed in 'Depends-On:' will be added to the artg_change_list
variable instead of overwriting its contents.

Both functionality is required in our TripleO jobs in the Ansible
OpenStack collection. There we want to build the RPM of
openstacksdk from its upstream master branch instead of using the
pinned version provided by RDO [1].

[1] f482a6ecc4/tags/zed-uc.yml (L467)

Change-Id: If44fe00bda10faa61df1dff9dc6da2ea26aa6b59
2022-07-15 09:08:28 +02:00
..
defaults Add diskimage-builder in artg_branchless_projects 2022-05-09 11:09:59 +05:30
library Refactor buildtestpackages for downstream purpose 2020-06-30 06:42:56 +00:00
meta Enable molecule placeholder test 2020-01-10 21:15:17 +00:00
molecule/default Bump molecule 2020-02-06 23:16:42 +00:00
tasks Allow to define artg_change_list variable in zuul jobs 2022-07-15 09:08:28 +02:00
templates Remove reference of Mitaka from built-test-packages 2022-04-18 12:52:38 +05:30
README.md update tqe openstack -> opendev 2019-04-22 13:17:19 -06:00

build-test-packages

An Ansible role for generating custom RPMSs from upstream Gerrit changes in the TripleO project using DLRN. This repo then can be injected in the tested environment, a repo file created and a yum update should start using the built RPMs.

Requirements

Role Variables

  • local_working_dir -- the directory where tripleo-quickstart is located
  • build_repo_dir -- the directory where the DLRN repo is built. The variable defaults to the home directory of the user.
  • artg_dlrn_repo_url -- the URL of the DLRN repository
  • artg_rdoinfo_repo_url -- the URL of the rdoinfo repository that contains the project definitions for DLRN
  • artg_compressed_gating_repo -- a full path to a compressed repository that contains all the generated rpms
  • artg_change_list -- a list of changes to gate. Only needed when not running in Zuul or Gerrit (see below). The format is:
  • artg_requirements -- used in roles mode, the requirements file to use for replacing the gated roles
  • artg_skipped_projects -- a list of projects that are not going to be gated. This is useful if the project is directly checked out by the gate job as this retains "Depends-On" functionality for the rest of the projects. Also useful to skip projects that DLRN cannot build.
  • artg_repos_dir -- Root directory which contains project directories with sources for build.
  • artg_build_one -- Boolean to indicate if dlrn should build one package at a time. If set to false, dlrn will be run to build all the required packages in one invocation of dlrn.
  • dlrn_target -- Target for the DLRN build Can be something like centos or fedora. Defaults to centos.
  • dlrn_baseurl -- URL used by DLRN to get the repo definitions when building packages
  • dlrn_use_local_mirrors -- use the local repo definitions from /etc/yum.repos.d/ for CentOS and DLRN while building packages; used upstream

Example artg_change_list for just code changes:

artg_change_list:
    - host: "review.opendev.org"
      project: "openstack/tripleo-heat-templates"
      branch: "master"
      refspec: "refs/changes/1/123456/1"
    - host: ...

Example artg_change_list for code changes and package changes:

artg_change_list:
    - host: "review.opendev.org"
      project: "openstack/tripleo-heat-templates"
      branch: "master"
      refspec: "refs/changes/1/123456/1"
      distgit:
          host: "ssh://user@review.rdoproject.org"
          project: "openstack/tripleo-heat-templates-distgit"
          refspec: "refs/changes/1/123456/1"
    - host: ...

Gating with Zuul or Jenkins

The role can also work with Zuul and Jenkins based gating jobs.

In case of Zuul, the role uses ZUUL_HOST and ZUUL_CHANGES vars to parse the full set of dependent changes that were previously resolved by Zuul.

If we're running in a Jenkins environment with the Gerrit Trigger plugin, GERRIT_HOST, GERRIT_CHANGE_ID, GERRIT_BRANCH and GERRIT_PATCHSET_REVISION are used to detect the gated change. The role then searches for "Depends-On:" lines in the commit message (and recursively in the commit messages of the dependent changes) and adds all of them to the gating list. This happens through Gerrit server's public REST API.

Example Playbook

---
- name: Build custom RPMs
  hosts: virthost
  roles:
    - build-test-packages

License

Apache

Author Information

RDO-CI Team