inverse_inc.gitlab_buildpkg_tools
gitlab_buildpkg_tools Role
This role helps to install the gitlab-buildpkg-tools PPA and the packages that are built using gitlab-buildpkg-tools in a GitLab pipeline.
This role can also:
- Add extra repositories
- Install GPG keys
- Install packages needed for dependencies in the pipeline
- Enable or disable repositories for Enterprise Linux (EL)
- Set repository priority for EL (requires yum-priorities package for EL8)
Requirements
This role is designed to be run within a GitLab pipeline, though it can also be run outside a pipeline with some manual variable setups.
Role Variables
Here are the available variables. Refer to defaults/main.yml
for default values:
gitlab_buildpkg_tools__ppa_enabled
: Whether to install the PPA repository and key.gitlab_buildpkg_tools__ppa_url
: The URL of the PPA.gitlab_buildpkg_tools__ppa_url_deb
: The URL of the PPA for Debian.gitlab_buildpkg_tools__ppa_url_centos
: The URL of the PPA for CentOS.gitlab_buildpkg_tools__deb_ppa
: Parameters for the Debian PPA repo.gitlab_buildpkg_tools__rpm_ppa
: Parameters for the RPM PPA repo.gitlab_buildpkg_tools__deb_deps_pkgs
: List of Debian package dependencies to install.gitlab_buildpkg_tools__deb_deps_pkgs_state
: State for Debian dependencies.gitlab_buildpkg_tools__deb_keys
: List of URLs for GPG keys.gitlab_buildpkg_tools__deb_combined_keys
: Combined list of GPG keys to install (PPA + extra).gitlab_buildpkg_tools__deb_sources_dir
: Directory for storing Debian repo files.gitlab_buildpkg_tools__deb_deps_repos
: Additional Debian repositories to include.gitlab_buildpkg_tools__deb_combined_repos
: List of Debian repositories to install.gitlab_buildpkg_tools__deb_pkgs
: List of Debian packages to install.gitlab_buildpkg_tools__deb_pkgs_state
: State of Debian packages to install.gitlab_buildpkg_tools__rpm_deps_pkgs
: List of CentOS package dependencies to install.gitlab_buildpkg_tools__rpm_deps_pkgs_state
: State of CentOS dependencies.gitlab_buildpkg_tools__rpm_keys
: List of URLs or files for GPG keys.gitlab_buildpkg_tools__rpm_combined_keys
: Combined list of GPG keys to install (PPA + extra).gitlab_buildpkg_tools__rpm_deps_repos
: Additional CentOS repositories to include.gitlab_buildpkg_tools__rpm_enabled_repos
: List of CentOS repositories to enable or disable.gitlab_buildpkg_tools__rpm_combined_repos
: List of CentOS repositories to install.gitlab_buildpkg_tools__rpm_pkgs
: List of CentOS packages to install.gitlab_buildpkg_tools__rpm_pkgs_state
: State of CentOS packages to install.
Pipeline Environment Variables
You need to set the following environment variables in a pipeline:
CI_PROJECT_NAME
CI_PAGES_URL
DEB_PACKAGES_NAME
RPM_PACKAGES_NAME
Limitations
Debian Limitations
- GPG keys must be provided via URL.
- Debian packages need to be specified by name.
Environment Variables in .gitlab-ci.yml
In your .gitlab-ci.yml
file, you can define variables like DEB_PACKAGES_NAME:
but they cannot be simple YAML lists or dictionaries. Use inline YAML syntax instead.
Examples
Example to Install Packages Inside a CI
In .gitlab-ci.yml
:
variables:
DEB_PACKAGES_NAME: "['apt-add-gitlab', 'gitlab-buildpkg-tools']"
RPM_PACKAGES_NAME: "['yum-add-gitlab', 'gitlab-buildpkg-tools']"
CI_PROJECT_NAME: gitlab-buildpkg-tools
CI_PAGES_URL: http://orange-opensource.gitlab.io/gitlab-buildpkg-tools
You do not need to define CI_PROJECT_NAME
and CI_PAGES_URL
if the playbook is already being used in a pipeline.
- For an example playbook, see the playbook.yml used for molecule tests.
Example to Install Packages with Additional Repos and Keys
See playbook-additional.yml used for molecule tests.
Example to Enable or Disable Repos for Enterprise Linux
See playbook-enable-disable-repos.yml used for molecule tests.
Testing This Role
This role cannot be fully tested in a GitLab CI pipeline due to restrictions on predefined environment variables (CI_PAGES_URL
and CI_PROJECT_NAME
). Therefore, Travis CI is used for testing.
Local Tests
Prerequisites:
- molecule[docker]
- ansible
- docker
Examples:
$ MOLECULE_DISTRO=debian11 \
CI_PROJECT_NAME=gitlab-buildpkg-tools \
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools \
MOLECULE_PLAYBOOK=playbook-ppa-and-additional.yml molecule test
$ MOLECULE_DISTRO=centos8 \
CI_PROJECT_NAME=gitlab-buildpkg-tools \
CI_PAGES_URL=http://orange-opensource.gitlab.io/gitlab-buildpkg-tools \
MOLECULE_PLAYBOOK=playbook-ppa-and-additional.yml molecule test
License
This role is licensed under GPL-3.0.
Author Information
Inverse Inc info@inverse.ca
Install packages from a gitlab-buildpkg-tools PPA
ansible-galaxy install inverse_inc.gitlab_buildpkg_tools