The deb/* branches contain the Debian packaging files for Foreman and it's dependencies. The repo mirrors Foreman Core, i.e. deb/develop is for packaging branch 'develop', deb/1.3 is for packaging release 1.3 and so on
It's generally best to contribute to 'deb/develop' unless something is specifically broken for an older release. Please fork and send a PR.
PRs will get automatically tested and test packages will be built into a per-user area on stagingdeb.theforeman.org. Example for adding a repository:
# curl -L https://stagingdeb.theforeman.org/foreman.asc | sudo apt-key add -
# deb http://stagingdeb.theforeman.org/ buster ares-nightly
Our PR test jobs are very picky about branch names, for which we apologise. Please
prefix your branch with the name of the target branch and a hyphen. For example,
a PR to deb/develop
could be called deb/develop-fix-foo
.
Automatic update for any plugin or regular dependency.
scripts/update_package.rb -n my-package -v 1.2.3
- Update any dependencies that may have changed
git commit -am "Updated my-package to 1.2.3"
Update under debian/*/foreman
, once per OS.
These are built as regular full Debian packages. Foreman itself ships its dependencies via a bundler cache stored inside the binary deb and uses the cache to install them during postinst.
To quickly bump version in all core projects, run e.g.:
scripts/changelog.rb -v 2.0.0 -m "Bump changelog to 2.0.0 to match VERSION" debian/{buster,focal}/foreman{,-installer,-proxy}/changelog
Foreman plugins are shipped as debs containing additional gems to add into the bundler cache, so get installed with core dependencies.
- Change version number in
plugins/ruby-foreman-example/debian/gem.list
and update any dependencies where possible - Change version number in
plugins/ruby-foreman-example/foreman_example.rb
- Run
scripts/changelog.rb -v 1.2.3 plugins/ruby-foreman-example/debian/changelog
Smart proxy plugins are shipped as regular Debian Ruby packages built to install gems into the system paths.
- Change version number in
plugins/smart_proxy_example/example.rb
- Run
scripts/changelog.rb -v 1.2.3 plugins/smart_proxy_example/debian/changelog
Dependencies are regular Debian Ruby packages that are used directly (such as Hammer) or as deps for smart proxy and Hammer or their plugins. They are built to install gems into system paths.
- Run
scripts/changelog.rb -v 1.2.3 dependencies/*/example/changelog
Adding a package into this repository.
- Debian machine (VM or container)
- Install
gem2deb
and a few optional dependencies:apt install gem2deb apt-file python3-debian
- Update
apt-file
cache, it's used for calculating dependencies:apt-file update
- Use
gem2deb
utility from Debian to generate a good starting point:gem2deb -s GEM_NAME
, this will produce aruby-GEM_NAME-VERSION
directory (the gem name will be mangled to match Debian rules: no underscores, lowercase only). - Create new directory
dependencies/*/GEM_NAME
(ensure it's exactly the name of the gem) - Copy the contents of
ruby-GEM_NAME-VERSION/debian/
todependencies/*/GEM_NAME
- Review the
control
file, debian package name must not include underscores, use dash characters instead (e.g.Source: ruby-rubygem-name
) - Review build dependencies, packages typically depend on
debhelper
,gem2deb
and optionally ongit
- Review runtime dependencies
- Review the
copyright
file and check the gem license - Review the
*.docs
file - Review the
changelog
file - See the Contributing section above for instructions on where to download the final build
Instructions are the same as for dependencies (see above) with the following differences:
- Directory must be created in
plugins/GEM_NAME
- Plugins typically depend on
foreman
orforeman-proxy
Sometimes it is beneficial to compare the contents of this Git repository with the contents on deb.theforeman.org.
$ ./scripts/compare_deb_repo.py --release X.Y
bionic
In repo but not in git:
{('ruby-foreman-ansible-core', '4.0.0-2'), ('ruby-yard', '0.9.8-1'), ('ruby-awesome-print', '1.8.0-1'), ('ruby-foreman-remote-execution-core', '1.5.0-1'), ('ruby-concurrent', '1.1.6+dfsg-2')}
In git but not in repo:
{('foreman-installer', '3.1.0-1'), ('foreman', '3.1.0-1'), ('foreman-proxy', '3.1.0-1')}
…
The output is formatted for each know "suite" (buster, focal, plugins) and lists packages (and their versions) that are either found in the repository, but not in git, or vice versa.
If there are packages that are in the repository, but not in git, this usually means that those packages weren't properly cleaned up.
If there are packages that are in git, but not in the repository, this usually means that the corresponding build failed or wasn't properly scheduled.
There is no automated way of removing packages from the Debian repository, once they have been removed from Git.
To remove a package from the Debian repository, two things need to happen:
- The package file needs to be removed from the server
- For core and dependencies, this happens in
/var/www/freight/apt/$SUITE/nightly/
and/var/www/freightstage/apt/$SUITE/theforeman-nightly/
- For plugins, this happens in
/var/www/freight/apt/plugins/nightly
- For core and dependencies, this happens in
- The package index needs to be regenerated
- This happens automatically on the next run of the cronjob, so you just need to wait
- verify that the Ruby version is supported by Foreman
- add the new release to the build infrastructure, like bullseye was added in foreman-infra@15ebf5b
- add the new release to forklift, like bullseye was added in forklift@b2ea4fe
- verify
puppet-agent
andpuppetserver
packages are available fromapt.puppet.com
- if
puppet-agent
isn't availableforeman-installer
won't build or run - if
puppetserver
isn't available packages will build, but deployment of Foreman will fail
- if
When building packages, we add our own repositories to the build environment, as they carry build dependencies. Because of that, we will have to create the repositories before building the first packages.
On the repository host, create the directories:
/var/www/freight/apt/$SUITE/nightly/
for the "real" repository/var/www/freightstage/apt/$SUITE/theforeman-nightly/
for the "staging" repository
chown
the directories to the freight
and freightstage
users accordingly.
As freight
doesn't publish repositories that have no content, we need to drop some .deb
package in each of these directories.
Ideally the package will have an older version, so it will be automatically cleaned up when we build the real package.
Once done, manually publish both repositories once:
# sudo -u freight /usr/bin/freight-cache -c /home/freight/freight.conf
# sudo -u freightstage /usr/bin/freight-cache -c /home/freightstage/freight.conf
Once all the infrastructure is in place, it's time to build the packages from the dependencies
directory.
The easiest way to do that is to copy the individual package directories from another Debian (or Ubuntu) release directory, preferable from the newest one.
While adding packages, please check if any of them are (now) available in Debian/Ubuntu and might not need packaging by us.
After the depdendencies are built, you can copy over foreman
, foreman-proxy
and foreman-installer
from another release directory.