[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.
This commit is contained in:
Earl Warren 2023-11-11 11:21:05 +01:00
parent d0f60d6ac2
commit 251cc1c26d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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}}"