rewrite to use gitlab-runner directly on host instead of in container

parent 114ac52a
Pipeline #2889 passed with stage
in 30 seconds
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.6)
apipie-bindings (0.2.2)
json (>= 1.2.1)
oauth
......@@ -9,32 +8,30 @@ GEM
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
facter (2.5.1)
CFPropertyList (~> 2.2)
fast_gettext (1.1.2)
git (1.3.0)
github-markup (2.0.0)
hiera (3.4.3)
git (1.5.0)
github-markup (2.0.1)
hiera (3.4.4)
http-cookie (1.0.3)
domain_name (~> 0.5)
json (2.1.0)
locale (2.1.2)
logger-colors (1.0.0)
mime-types (3.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mime-types-data (3.2018.0812)
multi_json (1.13.1)
net-ssh (4.2.0)
net-ssh (5.0.2)
netrc (0.11.0)
oauth (0.5.4)
puppet (5.5.1)
CFPropertyList (~> 2.2)
puppet (5.5.6)
facter (> 2.0.1, < 4)
fast_gettext (~> 1.1.2)
hiera (>= 3.2.1, < 4)
locale (~> 2.1)
multi_json (~> 1.10)
puppet-lint (2.3.5)
puppet-strings (2.0.0)
puppet-lint (2.3.6)
puppet-strings (2.1.0)
rgen
yard (~> 0.9.5)
puppet-syntax (2.4.1)
......@@ -49,7 +46,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
yard (0.9.12)
yard (0.9.16)
PLATFORMS
ruby
......@@ -69,4 +66,4 @@ DEPENDENCIES
yard
BUNDLED WITH
1.13.6
1.16.1
# BeryJu.org GitLab Module
<<<<<<< HEAD
=======
## Commands
`bundle` - Install necessary dependencies
`rake` - Run Syntax checks
## Creating a new Module
```
git init
git remote add template git@git.beryju.org:beryjuorg-puppet/template.git
git pull --allow-unrelated-histories template master
```
>>>>>>> b2791a5f3aea1eb4a91a2a84dde4be50b0764786
`rake` - Run Syntax checks
# Install the GitLab apt-repo
#
# @param suite Which Repository suite should be setup. Use `ce` for Gitlab CE and `runner` for Gitlab runners.
class beryjuorg_gitlab::repo (
Enum['ce', 'runner'] $suite = 'ce',
) {
apt::source { "gitlab-${suite}":
location => "http://packages.gitlab.com/${suite}/gitlab-${suite}/debian/",
release => $::lsbdistcodename,
repos => 'main',
key => {
'id' => '1A4C919DB987D435939638B914219A96E15E78F4',
'source' => 'https://packages.gitlab.com/gpg.key',
},
include => {
'src' => true,
'deb' => true,
}
}
if $suite == 'runner' {
apt::pin { 'packages.gitlab.com':
priority => 1001,
packages => ['gitlab-runner'],
}
}
}
......@@ -3,13 +3,26 @@
# @param ci_server_url The CI URL of the GitLab instance. Defaults to undef.
# @param ci_server_token The CI Token of the GitLab instance. Defaults to undef.
# @param runner_name The name of this runner. Defaults to $fqdn
# @param default_image Default docker image for the docker executor. Defaults to `debian:stable-slim`
# @param package_name Package to install. Defaults to `gitlab-runner`.
class beryjuorg_gitlab::runner (
$ci_server_url = undef,
$ci_server_token = undef,
$runner_name = $fqdn,
String $ci_server_url = undef,
String $ci_server_token = undef,
String $runner_name = $fqdn,
String $default_image = 'debian:stable-slim',
String $package_name = 'gitlab-runner'
) {
class { 'beryjuorg_gitlab::repo':
suite => 'runner',
}
->package { $package_name:
ensure => 'latest',
}
# Install and configure docker, and monitor it with telegraf
class {'docker':
require => Package[$package_name]
}
->exec { 'telegraf docker membership':
unless => '/bin/grep -q "docker\\S*telegraf" /etc/group',
......@@ -22,19 +35,9 @@ class beryjuorg_gitlab::runner (
'endpoint' => 'unix:///var/run/docker.sock',
},
}
->docker::image { 'gitlab/gitlab-runner':
ensure => latest,
}
->docker::run { 'gitlab-runner':
image => 'gitlab/gitlab-runner:latest',
volumes => [
'/var/run/docker.sock:/var/run/docker.sock',
'/srv/gitlab-runner/config:/etc/gitlab-runner'
]
}
->docker::exec { 'register':
->exec { 'register':
container => 'gitlab-runner',
command => "gitlab-ci-multi-runner register -n -u \"${ci_server_url}\" -r \"${ci_server_token}\" --name \"${runner_name}\" --executor \"docker\" --docker-image \"python:3.6\" --docker-privileged",
command => "gitlab-ci-multi-runner register -n -u \"${ci_server_url}\" -r \"${ci_server_token}\" --name \"${runner_name}\" --executor \"docker\" --docker-image \"${default_image}\" --docker-volumes /var/run/docker.sock:/var/run/docker.sock",
unless => '/usr/bin/test -f /etc/gitlab-runner/config.toml',
}
......
# Install and configure gitlab-ce
class beryjuorg_gitlab::server {
apt::source { 'gitlab-ce':
location => 'http://packages.gitlab.com/gitlab/gitlab-ce/debian/',
release => $::lsbdistcodename,
repos => 'main',
key => {
'id' => '1A4C919DB987D435939638B914219A96E15E78F4',
'source' => 'https://packages.gitlab.com/gpg.key',
},
include => {
'src' => true,
'deb' => true,
}
class { 'beryjuorg_gitlab::repo':
suite => 'ce',
}
package { 'gitlab-ce':
->package { 'gitlab-ce':
ensure => 'latest',
require => Apt::Source['gitlab-ce']
}
Firehol::Rule <<| tag == "${environment}_rp_http" |>>
......
{
"name": "beryjuorg-beryjuorg_gitlab",
"version": "0.1.0",
"author": "BeryJu.org <info@beryju.org>",
"summary": "",
"license": "MIT",
"source": "",
"dependencies": [],
"operatingsystem_support": [
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"9"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.7.0 < 6.0.0"
}
],
"pdk-version": "1.6.1",
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
"template-ref": "1.6.1-0-g6b0d497"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment