feat: add droneci runner

- ensure /data and docker are available
- add droneci runner configuration
This commit is contained in:
2024-08-25 01:11:58 +10:00
parent 2912cbb68b
commit d79a5de17b
5 changed files with 70 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
class droneci::runner (
Hash $env_vars = {},
String $docker_image = 'drone/drone-runner-docker:1',
Array[String] $ports = [],
Array[String] $volumes = [],
Stdlib::Absolutepath $env_file = '/etc/sysconfig/droneci_runner',
) {
# Create the environment file from a template
file { $env_file:
ensure => file,
content => template('droneci/droneci_env.erb'),
mode => '0644',
}
# Define the systemd service for Drone CI runner
systemd::unit_file { 'droneci-runner.service':
ensure => present,
content => template('droneci/droneci_runner_service.erb'),
enable => true,
active => true,
subscribe => File[$env_file],
}
}
@@ -0,0 +1,20 @@
[Unit]
Description=Drone CI Runner
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/bin/docker run --rm \
--name=drone-runner \
<% @ports.each do |port| -%>
-p <%= port %> \
<% end -%>
<% @volumes.each do |volume| -%>
--mount <%= volume %> \
<% end -%>
--env-file <%= @env_file %> \
<%= @docker_image %>
Restart=always
[Install]
WantedBy=multi-user.target