From 457cadcc38c5a4278521922e4b1b5c9799c69e59 Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Tue, 6 Feb 2024 23:13:12 +0100 Subject: [PATCH] Build image before first register run. --- manifests/runner.pp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/manifests/runner.pp b/manifests/runner.pp index a63631f..378f724 100644 --- a/manifests/runner.pp +++ b/manifests/runner.pp @@ -109,12 +109,21 @@ class podmanrunner::runner ( unless => "test -f /var/lib/systemd/linger/${user}${userpostfix}", } + # If required build runner image by podman-compose + exec { "${user}${userpostfix}-build-runner-image": + command => "${sdrun} /bin/bash -c 'podman-compose build'", + path => '/usr/bin:/usr/sbin:/bin', + provider => shell, + logoutput => false, + unless => "${sdrun} /bin/bash -c 'podman image ls | grep '^localhost/podmanrunner\s\s*3\.[0-9]\.[0-9]''", + } + # If not already done, register runner with forgejo instance. if $userdata and $userdata["token"] and $userdata["url"] { exec { "${user}${userpostfix}-register-runner": command => "${sdrun} /bin/bash -c 'podman run -it --rm -u podman -v ./runnerdata:/data:Z localhost/podmanrunner:3.3.0 /bin/bash -c \ \"date >> /data/register.log && forgejo-runner --config /data/config.yml register --no-interactive \ - --token ${userdata[\"token\"]} --name runner1 --instance ${userdata[\"url\"]} 1>>/data/register.log 2>&1\"'", + --token ${userdata["token"]} --name runner1 --instance ${userdata["url"]} 1>>/data/register.log 2>&1\"'", path => '/usr/bin:/usr/sbin:/bin', provider => shell, logoutput => false,