Skip to content

Commit

Permalink
Merge pull request #440 from NeatNerdPrime/feature/package_hold
Browse files Browse the repository at this point in the history
Debian: Add support for holding a package
  • Loading branch information
bastelfreak authored Nov 4, 2024
2 parents 74a54a0 + e60341b commit 0717c5b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Each unique resource provided to the `repository_configuration` setup:

You can use these tags to further customize ordering within your own catalogs.

#### Selecting Version, edition, and package name
#### Selecting Version, edition, package name and holding

The `package_ensure` parameter is used to control which version of the package
installed. It expects either a version string, or one of the `ensure` values for
Expand All @@ -242,6 +242,13 @@ This approach of package management has the following advantages:
* allows you to install custom built packages for gitlab-omnibus that have
different package name on your host

The `package_hold` parameter allows you to hold the package version in the APT
package manager. This is useful when you intend to update the host with
'apt upgrade' (or the bolt task `apt action=upgrade` from puppetlabs-apt) and
keep your gitlab instance at the intended version. This prevents unintended
upgrading gitlab and perhaps skipping important upgrade path steps.
To learn more about gitlab upgrading please visit the [upgrade path page.](https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/)

#### Custom Repository & Package configuration example

As an expanded example of repository and package configuration, let's assume you're:
Expand Down
18 changes: 18 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ The following parameters are available in the `gitlab` class:
* [`backup_cron_minute`](#-gitlab--backup_cron_minute)
* [`backup_cron_hour`](#-gitlab--backup_cron_hour)
* [`backup_cron_skips`](#-gitlab--backup_cron_skips)
* [`package_hold`](#-gitlab--package_hold)
* [`package_name`](#-gitlab--package_name)
* [`manage_package`](#-gitlab--manage_package)
* [`repository_configuration`](#-gitlab--repository_configuration)
Expand Down Expand Up @@ -825,6 +826,14 @@ Array of items to skip valid values: db, uploads, repositories, builds, artifact

Default value: `[]`

##### <a name="-gitlab--package_hold"></a>`package_hold`

Data type: `Enum['hold', 'none']`

Wether to hold the specified package version. Available options are 'hold' or 'none'. Defaults to 'none'. Available only for Debian/Solaris package managers.

Default value: `'none'`

##### <a name="-gitlab--package_name"></a>`package_name`

Data type: `Optional[String]`
Expand Down Expand Up @@ -1029,6 +1038,7 @@ The following parameters are available in the `gitlab::install` class:

* [`package_name`](#-gitlab--install--package_name)
* [`package_ensure`](#-gitlab--install--package_ensure)
* [`package_hold`](#-gitlab--install--package_hold)
* [`manage_package`](#-gitlab--install--manage_package)

##### <a name="-gitlab--install--package_name"></a>`package_name`
Expand All @@ -1047,6 +1057,14 @@ Data type: `Any`

Default value: `$gitlab::package_ensure`

##### <a name="-gitlab--install--package_hold"></a>`package_hold`

Data type: `Any`



Default value: `$gitlab::package_hold`

##### <a name="-gitlab--install--manage_package"></a>`manage_package`

Data type: `Any`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
# @param backup_cron_minute The minute when to run the daily backup cron job
# @param backup_cron_hour The hour when to run the daily backup cron job
# @param backup_cron_skips Array of items to skip valid values: db, uploads, repositories, builds, artifacts, lfs, registry, pages
# @param package_hold Wether to hold the specified package version. Available options are 'hold' or 'none'. Defaults to 'none'. Available only for Debian/Solaris package managers.
# @param package_name The internal packaging system's name for the package. This name will automatically be changed by the gitlab::edition parameter. Can be overridden for the purposes of installing custom compiled version of gitlab-omnibus.
# @param manage_package Should the GitLab package be managed?
# @param repository_configuration A hash of repository types and attributes for configuraiton the gitlab package repositories. See docs in README.md
Expand Down Expand Up @@ -158,6 +159,7 @@
Optional[Hash] $pgbouncer_exporter = undef,
Optional[Hash] $gitlab_monitor = undef,
Optional[Hash] $gitlab_exporter = undef,
Enum['hold', 'none'] $package_hold = 'none',
Optional[String] $package_name = undef,
Optional[String] $pages_external_url = undef,
Optional[Hash] $pages_nginx = undef,
Expand Down
2 changes: 2 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class gitlab::install (
$package_name = $gitlab::package_name,
$package_ensure = $gitlab::package_ensure,
$package_hold = $gitlab::package_hold,
$manage_package = $gitlab::manage_package,
) {
assert_private()
Expand All @@ -26,6 +27,7 @@
package { 'gitlab-omnibus':
ensure => $package_ensure,
name => $_package_name,
mark => $package_hold,
require => Class['gitlab::omnibus_package_repository'],
}
}
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,15 @@
with_content(%r{^\s*gitlab_sshd\['enable'\] = true$})
}
end
describe 'package_hold' do
let(:params) do
{ package_ensure: '16.10.3-ce.0', package_hold: 'hold' }
end

it {
is_expected.to contain_package('gitlab-omnibus').with('ensure' => '16.10.3-ce.0', 'name' => 'gitlab-ce', 'mark' => 'hold')
}
end
end
end
end
Expand Down

0 comments on commit 0717c5b

Please sign in to comment.