fix: [container].docker_host = "" is now "automount"

The empty string is always replaced with "-" and there no longer is
any way to specify that the docker socket is to be mounted in the
container automatically.

The "automount" value is introduced as a replacement.

https://code.forgejo.org/forgejo/act/pulls/67 and
https://code.forgejo.org/forgejo/runner/pulls/305 introduced this regression.
This commit is contained in:
Earl Warren 2024-11-27 00:28:35 +00:00
parent eee0b082fb
commit 279faefa08
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 9 additions and 11 deletions

View file

@ -89,8 +89,8 @@ container:
# - '**'
valid_volumes: []
# overrides the docker client host with the specified one.
# If "-", an available docker host will automatically be found.
# If empty, an available docker host will automatically be found and mounted in the job container (e.g. /var/run/docker.sock).
# If "-" or "", an available docker host will automatically be found.
# If "automount", an available docker host will automatically be found and mounted in the job container (e.g. /var/run/docker.sock).
# Otherwise the specified docker host will be used and an error will be returned if it doesn't work.
docker_host: "-"
# Pull docker image(s) even if already present

View file

@ -13,10 +13,7 @@ import (
func CheckIfDockerRunning(ctx context.Context, configDockerHost string) error {
opts := []client.Opt{
client.FromEnv,
}
if configDockerHost != "" {
opts = append(opts, client.WithHost(configDockerHost))
client.WithHost(configDockerHost),
}
cli, err := client.NewClientWithOpts(opts...)