GitLab CI template for Debian packages¶
This project implements a GitLab CI/CD template to build Debian packages.
Usage¶
This template can be used both as a CI/CD component
or using the legacy include:project
syntax.
Use as a CI/CD component¶
Add the following to your .gitlab-ci.yml
:
include:
# 1: include the component
- component: $CI_SERVER_FQDN/to-be-continuous/debian/gitlab-ci-debian@1.0.1
# 2: set/override component inputs
inputs:
# ⚠ this is only an example
spec-file: debian/myapp.spec
Use as a CI/CD template (legacy)¶
Add the following to your .gitlab-ci.yml
:
include:
# 1: include the template
- project: "to-be-continuous/debian"
ref: "1.0.1"
file: "/templates/gitlab-ci-debian.yml"
variables:
# 2: set/override template variables
# ⚠ this is only an example
DEBIAN_SPEC_FILE: debian/myapp.spec
Global configuration¶
The Debian template uses some global configuration used throughout all jobs.
Jobs¶
debian-build
job¶
This job builds the Debian source package.
It uses the following variable:
Input / Variable | Description | Default value |
---|---|---|
build-image / DEBIAN_BUILD_IMAGE |
The Docker image used to run dpkg-buildpackage .(only define if different from default image) |
$DEBIAN_BASE_IMAGE |
build-opts / DEBIAN_BUILD_OPTS |
dpkg-buildpackage options used to build the Debian package |
--unsigned-source --unsigned-changes |
The result of the build (.buildinfo
, .changes
, .dsc
, .deb
files) will be saved as a build artifact in the $DEBIAN_SOURCE_DIR/dpkg-build/
output folder.
Any further job in the pipeline may retieve the built Debian package(s) in this folder (for instance to install them or publish them to some Debian repository).
Build dependencies automatic install¶
Prior to building the Debian package, the template first install all dependencies declared in your source package.
lintian
analysis support¶
The build job might also perform a lintian analysis of your built package (enabled by default).
It uses the following additional variables:
Input / Variable | Description | Default value |
---|---|---|
lint-image / DEBIAN_LINT_IMAGE |
The Docker image used to run lintian .(only define if different from default image) |
$DEBIAN_BASE_IMAGE |
lint-disabled / DEBIAN_LINT_DISABLED |
Set to true to disable the lintian analysis |
none (enabled) |
lint-opts / DEBIAN_LINT_OPTS |
lintian options |
--info |
If a .lintianignore
file is found in your source directory (source-dir
/ DEBIAN_SOURCE_DIR
) or at the root of your repository, it will be automatically passed by the template as the --suppress-tags-from-file
option (should list all tags to ignore).
Extra - Recommended resources¶
Here are some recommended resources about Debian packaging: