summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorEarl Warren <contact@earl-warren.org>2023-11-11 11:21:05 +0100
committerEarl Warren <contact@earl-warren.org>2024-03-11 09:30:55 +0100
commit251cc1c26dd2d7de7a522ac202bc576a706faca6 (patch)
tree240ef46bdf5a12f5b318507e4b396db970a08a7b /pkg
parent[LXC] split platform into template, release and config (diff)
downloadforgejo-act-251cc1c26dd2d7de7a522ac202bc576a706faca6.tar.xz
forgejo-act-251cc1c26dd2d7de7a522ac202bc576a706faca6.zip
[LXC] global lock on start
Since the start script may create LXC templates that are shared, they may race against each other when running for the first time. A lock global to the host needs to be used to guarantee that does not happen.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/runner/run_context.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go
index d273fd2..1f0924f 100644
--- a/pkg/runner/run_context.go
+++ b/pkg/runner/run_context.go
@@ -194,6 +194,8 @@ var lxcHelpers string
var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -e
+exec 5<>/tmp/forgejo-runner-lxc.lock ; flock --timeout 21600 5
+
LXC_CONTAINER_CONFIG="{{.Config}}"
LXC_CONTAINER_RELEASE="{{.Release}}"