[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 844f117f31
commit bf72e67041
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -189,6 +189,8 @@ var lxcHelpers string
var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -e 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_CONFIG="{{.Config}}"
LXC_CONTAINER_RELEASE="{{.Release}}" LXC_CONTAINER_RELEASE="{{.Release}}"