diff --git a/hieradata/roles/infra/git/runner.yaml b/hieradata/roles/infra/git/runner.yaml index 19d57a4..e543f5d 100644 --- a/hieradata/roles/infra/git/runner.yaml +++ b/hieradata/roles/infra/git/runner.yaml @@ -8,9 +8,9 @@ docker::version: latest docker::curl_ensure: false docker::root_dir: /data/docker +profiles::gitea::runner::instance: https://git.unkin.net profiles::gitea::runner::home: /data/runner -profiles::gitea::runner::version: '0.2.10' -profiles::gitea::runner::source: "https://gitea.com/gitea/act_runner/releases/download/v%{hiera('profiles::gitea::runner::version')}/act_runner-%{hiera('profiles::gitea::runner::version')}-linux-amd64" +profiles::gitea::runner::version: '0.2.12' profiles::gitea::runner::config: log: level: info diff --git a/site/profiles/manifests/gitea/runner.pp b/site/profiles/manifests/gitea/runner.pp index 761a04d..d8dd11f 100644 --- a/site/profiles/manifests/gitea/runner.pp +++ b/site/profiles/manifests/gitea/runner.pp @@ -1,13 +1,12 @@ # profiles::gitea::init class profiles::gitea::runner ( String $registration_token, - Stdlib::HTTPSUrl $source, String $user = 'runner', String $group = 'runner', Stdlib::Absolutepath $home = '/data/runner', Hash $config = {}, Stdlib::HTTPSUrl $instance = 'https://git.query.consul', - String $version = '0.2.10', + String $version = 'latest', ) { group { $group: @@ -32,24 +31,27 @@ class profiles::gitea::runner ( require => User[$user], } - archive { '/usr/local/bin/act_runner': - ensure => present, - extract => false, - source => $source, - creates => '/usr/local/bin/act_runner', - cleanup => true, + unless $version in ['latest', 'present'] { + # versionlock act + yum::versionlock{ 'act_runner': + ensure => present, + version => $version, + before => Package['act_runner'], + } } + # install act + package { 'act_runner': + ensure => $version, + } + + # remove manually installed act_runner file { '/usr/local/bin/act_runner': - ensure => 'file', - mode => '0755', - owner => 'root', - group => 'root', - require => Archive['/usr/local/bin/act_runner'], + ensure => absent, } - exec {'register_act_runner': - command => "/usr/local/bin/act_runner register \ + exec { 'register_act_runner': + command => "/usr/bin/act_runner register \ --no-interactive \ --instance ${instance} \ --token ${registration_token} \ @@ -60,12 +62,12 @@ class profiles::gitea::runner ( user => $user, group => $group, require => [ - File['/usr/local/bin/act_runner'], + Package['act_runner'], File["${home}/config.yaml"], ], } - systemd::unit_file {'act_runner.service': + systemd::unit_file { 'act_runner.service': enable => true, active => true, content => template('profiles/gitea/act_runner.service.erb'), diff --git a/site/profiles/templates/gitea/act_runner.service.erb b/site/profiles/templates/gitea/act_runner.service.erb index 2bff552..1439627 100644 --- a/site/profiles/templates/gitea/act_runner.service.erb +++ b/site/profiles/templates/gitea/act_runner.service.erb @@ -4,7 +4,7 @@ Documentation=https://gitea.com/gitea/act_runner After=docker.service [Service] -ExecStart=/usr/local/bin/act_runner daemon --config <%= @home %>/config.yaml +ExecStart=/usr/bin/act_runner daemon --config <%= @home %>/config.yaml ExecReload=/bin/kill -s HUP $MAINPID WorkingDirectory=<%= @home %> TimeoutSec=0