RHEL templates¶
The RHEL template file rhel.yml
can be included via
include:
- project: computing/gitlab-ci-templates
file: rhel.yml
This file provides the following job templates
.rhel:cache
¶
Description¶
Configures caching of resources used by yum
(RHEL <= 7) or dnf
(RHEL >= 8).
Example usage¶
rhel:
extends:
- .rhel:cache
.rhel:base
¶
Extends: .rhel:cache
Description¶
The base RHEL job template. This template includes a before_script
stage that does the following:
- ensures
dnf
is installed - configures caching with
dnf
- disables repositories specified by the user (optional)
- enables EPEL (optional)
- enables PowerTools on EL8 (optional)
For best results, the before_script
of this template should always be executed, either by not overwriting that section of the template, or via by using a !reference
tag.
The job can be configured using the following variables:
Name | Default | Purpose |
---|---|---|
DISABLE_REPOS | (empty) | space-separated list of RPM repositories to disable |
EPEL | "false" | if "true" , configure EPEL package repo and install epel-rpm-macros |
POWERTOOLS | "false" | if "true" , enable the CentOS 8 PowerTools repo module |
Example usage¶
This example adds extra commands to the before_script
stage while using a !reference
tag to execute all of the template commands as well:
rhel:
extends:
- .rhel:base
image: rockylinux:8
before_script:
- !reference [".rhel:base", before_script]
- dnf -y -q install python3
script:
- python3 --version
Quote the template job name when using !reference
tags
When using gitlab-ci's !reference
tags it is important to quote the job name, since it contains a colon (:
).
.rhel:srpm
¶
Extends: .rhel:base
Description¶
This job builds a source RPM (SRPM, .src.rpm
) from a tarball. The .src.rpm
file is uploaded as a job artifact.
With default options, this job approximately runs the following:
rpmbuild -ts ${TARBALL}
The job can be configured using the following variables:
Name | Default | Purpose |
---|---|---|
DISABLE_PYTHON_PACKAGE_INDEX | "true" | if "true" , disable downloading packages on-the-fly from the Python package index |
EPEL | "false" | if "true" , configure EPEL package repo and install epel-rpm-macros |
POWERTOOLS | "false" | if "true" , enable the CentOS 8 PowerTools repo module |
RPMBUILD_OPTIONS | (empty) | options to pass to rpmbuild |
SRPM_DEPENDENCIES | (empty) | extra packages to yum install before building the source RPM |
TARBALL | ${CI_PROJECT_NAME}-*.tar.* | the source tarball to build from |
Example usage¶
To build a source RPM using a tarball from a previous stage:
srpm:
extends:
- .rhel:srpm
needs:
- tarball
variables:
TARBALL: myproject-*.tar.gz
.rhel:rpm
¶
Extends: .rhel:base
Description¶
This job takes in a source RPM and builds one or more binary RPMs (.rpm
s). The .rpm
packagese are uploaded as job artifacts.
With default options, this job approximately runs the following:
yum-builddep ${SRPM}
rpmbuild --rebuild ${SRPM}
The job can be configured using the following variables:
Name | Default | Purpose |
---|---|---|
DISABLE_PYTHON_PACKAGE_INDEX | "true" | if "true" , disable downloading packages on-the-fly from the Python package index |
EPEL | "false" | if "true" , configure EPEL package repo and install epel-rpm-macros |
POWERTOOLS | "false" | if "true" , enable the CentOS 8 PowerTools repo module |
RPMBUILD_OPTIONS | (empty) | options to pass to rpmbuild |
RPM_DEPENDENCIES | "" (empty) | extra packages to yum install before building the binary RPMs (build requirements do not need to be listed here) |
SRPM | ${CI_PROJECT_NAME}-*.src.rpm | the source RPM to build from |
Example usage¶
rpm:
extends:
- .rhel:rpm
needs:
- srpm
variables:
SRPM: "myproject_*.dsc"
To build out source and binary RPMs for a Python project in a single job, one might consider something like this:
rpm:
extends:
# extend from the 'rpm' template to upload
# the binary packages as artifacts automatically
- .rhel:rpm
before_script:
# run the `before_script` for the source package template
- !reference [".rhel:srpm", before_script]
# run the `before_script` for the binary package template
- !reference [".rhel:rpm", before_script]
script:
# generate a tarball
- python setup.py sdist --dist-dir .
# generate the source package
- !reference [".rhel:srpm", before_script]
# generate the binary package
- !reference [".rhel:rpm", before_script]
.rhel:lint
¶
Extends: .rhel:base
Description¶
Runs rpmlint
against one or more RPMs.
The job can be configured using the following variables:
Name | Default | Purpose |
---|---|---|
INSTALLED_RPMS | (empty) | installed RPMs to lint |
RPMLINT_OPTIONS | --info | options to pass to rpmlint |
RPMS | "*.rpm" | RPM files to lint |
Example usage¶
rpmlint:
extends:
- .rhel:lint
needs:
# pull in packages from the `rpm` job
- rpm