Skip to content

Commit

Permalink
Add basic SuSE support
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxmea committed May 28, 2024
1 parent 473633d commit c87ad99
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 22 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ fixtures:
ruby_task_helper: "https://github.com/puppetlabs/puppetlabs-ruby_task_helper.git"
translate: "https://github.com/puppetlabs/puppetlabs-translate.git"
yumrepo_core: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@

#### Table of Contents

1. [Overview](#overview)
1. [Usage - Configuration options and additional functionality](#usage)
1. [Limitations - OS compatibility, etc.](#limitations)
1. [Upgrading from version 3](#upgrading-from-version-3)
1. [License](#license)
- [Gitlab-CI runner module for Puppet](#gitlab-ci-runner-module-for-puppet)
- [Table of Contents](#table-of-contents)
- [Overview](#overview)
- [Usage](#usage)
- [SLES](#sles)
- [Upgrading from version 3](#upgrading-from-version-3)
- [Limitations](#limitations)
- [License](#license)

## Overview

Expand Down Expand Up @@ -69,6 +72,17 @@ gitlab_ci_runner::runners:
ensure: absent
```

## SLES

There are no gitlab_ci_runner repositories for SLES/zypper available!
Please set the following data to be able to use this module on SLES:

```yaml
gitlab_ci_runner::install_method: 'binary' # required for SLES
gitlab_ci_runner::binary_source: 'https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-linux-amd64' # default value
gitlab_ci_runner::binary_path: '/usr/local/bin/gitlab-runner' # default value
```

## Upgrading from version 3

Version 4 of this module introduces some big changes.
Expand Down
27 changes: 27 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ The following parameters are available in the `gitlab_ci_runner` class:
* [`listen_address`](#-gitlab_ci_runner--listen_address)
* [`session_server`](#-gitlab_ci_runner--session_server)
* [`manage_docker`](#-gitlab_ci_runner--manage_docker)
* [`install_method`](#-gitlab_ci_runner--install_method)
* [`binary_source`](#-gitlab_ci_runner--binary_source)
* [`binary_path`](#-gitlab_ci_runner--binary_path)
* [`manage_repo`](#-gitlab_ci_runner--manage_repo)
* [`package_ensure`](#-gitlab_ci_runner--package_ensure)
* [`package_name`](#-gitlab_ci_runner--package_name)
Expand Down Expand Up @@ -190,6 +193,30 @@ If docker should be installs (uses the puppetlabs-docker).

Default value: `false`

##### <a name="-gitlab_ci_runner--install_method"></a>`install_method`

Data type: `Enum['repo', 'binary']`

If repo or binary should be installed

Default value: `'repo'`

##### <a name="-gitlab_ci_runner--binary_source"></a>`binary_source`

Data type: `Stdlib::HTTPUrl`

URL to the binary file

Default value: `'https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-linux-amd64'`

##### <a name="-gitlab_ci_runner--binary_path"></a>`binary_path`

Data type: `Stdlib::Absolutepath`

Absolute path where to install gitlab_runner binary

Default value: `'/usr/local/bin/gitlab-runner'`

##### <a name="-gitlab_ci_runner--manage_repo"></a>`manage_repo`

Data type: `Boolean`
Expand Down
3 changes: 3 additions & 0 deletions data/family/Suse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
gitlab_ci_runner::install_method: 'binary'
gitlab_ci_runner::manage_repo: false
9 changes: 9 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
# Session server lets users interact with jobs, for example, in the interactive web terminal.
# @param manage_docker
# If docker should be installs (uses the puppetlabs-docker).
# @param install_method
# If repo or binary should be installed
# @param binary_source
# URL to the binary file
# @param binary_path
# Absolute path where to install gitlab_runner binary
# @param manage_repo
# If the repository should be managed.
# @param package_ensure
Expand Down Expand Up @@ -89,6 +95,9 @@
Optional[String] $sentry_dsn = undef,
Optional[Pattern[/.*:.+/]] $listen_address = undef,
Optional[Gitlab_ci_runner::Session_server] $session_server = undef,
Enum['repo', 'binary'] $install_method = 'repo',
Stdlib::HTTPUrl $binary_source = 'https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-linux-amd64',
Stdlib::Absolutepath $binary_path = '/usr/local/bin/gitlab-runner',
Boolean $manage_docker = false,
Boolean $manage_repo = true,
String $package_ensure = installed,
Expand Down
20 changes: 18 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@
) {
assert_private()

package { $package_name:
ensure => $package_ensure,
case $gitlab_ci_runner::install_method {

Check warning on line 11 in manifests/install.pp

View workflow job for this annotation

GitHub Actions / Setup Test Matrix

case statement without a default case (check: case_without_default)
'repo': {
package { $package_name:
ensure => $package_ensure,
}
}
'binary': {
$_package_ensure = $package_ensure ? {
'installed' => 'present',
default => $package_ensure,
}
archive { $gitlab_ci_runner::binary_path:
ensure => $_package_ensure,
source => $gitlab_ci_runner::binary_source,
extract => false,
creates => $gitlab_ci_runner::binary_path,
}
}
}
}
7 changes: 7 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
"20.04",
"22.04"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"12",
"15"
]
}
],
"requirements": [
Expand Down
35 changes: 20 additions & 15 deletions spec/classes/gitlab_ci_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@

it { is_expected.not_to contain_class('docker') }
it { is_expected.not_to contain_class('docker::images') }
it { is_expected.to contain_package('gitlab-runner') }

it { is_expected.to contain_package('gitlab-runner') } unless facts[:os]['family'] == 'Suse'

it { is_expected.to contain_service('gitlab-runner') }
it { is_expected.to contain_class('gitlab_ci_runner::install') }

Expand Down Expand Up @@ -337,20 +339,22 @@
}
end

it { is_expected.to compile }
unless facts[:os]['family'] == 'Suse'
it { is_expected.to compile }

it { is_expected.to contain_class('docker') }
it { is_expected.to contain_class('docker') }

it do
is_expected.to contain_class('docker::images').
with(
images: {
'ubuntu_focal' => {
'image' => 'ubuntu',
'image_tag' => 'focal'
it do
is_expected.to contain_class('docker::images').
with(
images: {
'ubuntu_focal' => {
'image' => 'ubuntu',
'image_tag' => 'focal'
}
}
}
)
)
end
end
end

Expand All @@ -361,9 +365,10 @@
)
end

it { is_expected.to compile }
it { is_expected.to contain_class('gitlab_ci_runner::repo') }

unless facts[:os]['family'] == 'Suse'
it { is_expected.to compile }
it { is_expected.to contain_class('gitlab_ci_runner::repo') }
end
case facts[:os]['family']
when 'Debian'
it do
Expand Down

0 comments on commit c87ad99

Please sign in to comment.