[libvirt-jenkins-ci PATCH 2/5] guests: templates: Introduce a gitlab-runner RC init service template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 .../update/templates/gitlab-runner.j2         | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 guests/playbooks/update/templates/gitlab-runner.j2

diff --git a/guests/playbooks/update/templates/gitlab-runner.j2 b/guests/playbooks/update/templates/gitlab-runner.j2
new file mode 100644
index 0000000..5063a53
--- /dev/null
+++ b/guests/playbooks/update/templates/gitlab-runner.j2
@@ -0,0 +1,32 @@
+#!/bin/sh
+# PROVIDE: gitlab_runner
+# REQUIRE: DAEMON NETWORKING
+# BEFORE:
+# KEYWORD:
+
+. /etc/rc.subr
+
+name="gitlab_runner"
+rcvar="gitlab_runner_enable"
+
+user="{{ flavor }}"
+user_home="/home/{{ flavor }}"
+command="/usr/local/bin/gitlab-runner"
+command_args="run --user ${user} --working-directory ${user_home} --config ${user_home}/.gitlab-runner/config.toml"
+pidfile="/var/run/${name}.pid"
+
+start_cmd="gitlab_runner_start"
+
+gitlab_runner_start()
+{
+    export USER=${user}
+    export HOME=${user_home}
+    export PATH=${PATH}:/usr/local/bin/:/usr/local/sbin/
+    if checkyesno ${rcvar}; then
+        cd ${user_home}
+    /usr/sbin/daemon -p ${pidfile} ${command} ${command_args} > /var/log/gitlab-runner.log 2>&1
+        fi
+}
+
+load_rc_config $name
+run_rc_command $1
-- 
2.25.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux