diff --git a/.fixtures.yml b/.fixtures.yml
index 3020aba..d57507d 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -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"
diff --git a/README.md b/README.md
index ffa30c1..546deb1 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -69,6 +72,20 @@ gitlab_ci_runner::runners:
ensure: absent
```
+## SLES
+
+There are no gitlab_ci_runner repositories for SLES/zypper available!
+Instead one can use the go binary.
+This setup requires the [puppet-archive](https://github.com/voxpupuli/puppet-archive) module.
+
+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.
diff --git a/REFERENCE.md b/REFERENCE.md
index 3955c11..70af003 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -81,6 +81,12 @@ 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_user`](#-gitlab_ci_runner--manage_user)
+* [`user`](#-gitlab_ci_runner--user)
+* [`group`](#-gitlab_ci_runner--group)
* [`manage_repo`](#-gitlab_ci_runner--manage_repo)
* [`package_ensure`](#-gitlab_ci_runner--package_ensure)
* [`package_name`](#-gitlab_ci_runner--package_name)
@@ -190,6 +196,54 @@ If docker should be installs (uses the puppetlabs-docker).
Default value: `false`
+##### `install_method`
+
+Data type: `Enum['repo', 'binary']`
+
+If repo or binary should be installed
+
+Default value: `'repo'`
+
+##### `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'`
+
+##### `binary_path`
+
+Data type: `Stdlib::Absolutepath`
+
+Absolute path where to install gitlab_runner binary
+
+Default value: `'/usr/local/bin/gitlab-runner'`
+
+##### `manage_user`
+
+Data type: `Boolean`
+
+If the user should be managed.
+
+Default value: `false`
+
+##### `user`
+
+Data type: `String[1]`
+
+The user to manage.
+
+Default value: `'gitlab-runner'`
+
+##### `group`
+
+Data type: `String[1]`
+
+The group to manage.
+
+Default value: `$user`
+
##### `manage_repo`
Data type: `Boolean`
diff --git a/data/family/Suse.yaml b/data/family/Suse.yaml
new file mode 100644
index 0000000..4aa725a
--- /dev/null
+++ b/data/family/Suse.yaml
@@ -0,0 +1,5 @@
+---
+gitlab_ci_runner::install_method: 'binary'
+gitlab_ci_runner::manage_repo: false
+gitlab_ci_runner::manage_config_dir: true
+gitlab_ci_runner::manage_user: true
diff --git a/manifests/init.pp b/manifests/init.pp
index dc58275..d76dbc7 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -35,6 +35,18 @@
# 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_user
+# If the user should be managed.
+# @param user
+# The user to manage.
+# @param group
+# The group to manage.
# @param manage_repo
# If the repository should be managed.
# @param package_ensure
@@ -89,6 +101,12 @@
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_user = false,
+ String[1] $user = 'gitlab-runner',
+ String[1] $group = $user,
Boolean $manage_docker = false,
Boolean $manage_repo = true,
String $package_ensure = installed,
diff --git a/manifests/install.pp b/manifests/install.pp
index d32eebb..af501c1 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -8,7 +8,39 @@
) {
assert_private()
- package { $package_name:
- ensure => $package_ensure,
+ case $gitlab_ci_runner::install_method {
+ '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,
+ }
+ file { $gitlab_ci_runner::binary_path:
+ ensure => file,
+ mode => '0755',
+ }
+ if $gitlab_ci_runner::manage_user {
+ group { $gitlab_ci_runner::group:
+ ensure => present,
+ }
+ user { $gitlab_ci_runner::user:
+ ensure => present,
+ gid => $gitlab_ci_runner::group,
+ }
+ }
+ }
+ default: {
+ fail("Unsupported install method: ${gitlab_ci_runner::install_method}")
+ }
}
}
diff --git a/manifests/service.pp b/manifests/service.pp
index d1d08bf..5f73cf7 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -7,6 +7,11 @@
) {
assert_private()
+ if $facts['os']['family'] == 'Suse' {
+ exec { "${gitlab_ci_runner::binary_path} install -u ${gitlab_ci_runner::user}":
+ creates => '/etc/systemd/system/gitlab-runner.service',
+ }
+ }
service { $package_name:
ensure => running,
enable => true,
diff --git a/metadata.json b/metadata.json
index fe3b1f5..4aa713f 100644
--- a/metadata.json
+++ b/metadata.json
@@ -73,6 +73,13 @@
"20.04",
"22.04"
]
+ },
+ {
+ "operatingsystem": "SLES",
+ "operatingsystemrelease": [
+ "12",
+ "15"
+ ]
}
],
"requirements": [
diff --git a/spec/classes/gitlab_ci_runner_spec.rb b/spec/classes/gitlab_ci_runner_spec.rb
index 0ec2caa..a10e617 100644
--- a/spec/classes/gitlab_ci_runner_spec.rb
+++ b/spec/classes/gitlab_ci_runner_spec.rb
@@ -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') }
@@ -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
@@ -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