Merge pull request #1442 from lheckemann/gitlab-runner-fix

gitlab-runner: write config as toml, don't clobber existing file
This commit is contained in:
Michael Hoang 2025-05-13 22:20:02 +10:00 committed by GitHub
commit f88be00227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,6 +19,7 @@ let
# make config file readable by service
chown -R --reference=$HOME $(dirname ${configPath})
'' else ''
set -e
export CONFIG_FILE=${configPath}
mkdir -p $(dirname ${configPath})
@ -92,8 +93,8 @@ let
done
# update global options
remarshal --if toml --of json ${configPath} \
| jq -cM ${escapeShellArg (concatStringsSep " | " [
tomlq -t \
${escapeShellArg (concatStringsSep " | " [
".check_interval = ${toJSON cfg.checkInterval}"
".concurrent = ${toJSON cfg.concurrent}"
".sentry_dsn = ${toJSON cfg.sentryDSN}"
@ -103,9 +104,9 @@ let
".session_server.session_timeout = ${toJSON cfg.sessionServer.sessionTimeout}"
"del(.[] | nulls)"
"del(.session_server[] | nulls)"
])} \
| remarshal --if json --of toml \
| sponge ${configPath}
])} ${configPath} \
> config.toml.new
mv config.toml.new ${configPath}
# make config file readable by service
chown -R --reference=$HOME $(dirname ${configPath})
@ -559,7 +560,7 @@ in
gawk
jq
moreutils
remarshal
yq
# util-linux
cfg.package
coreutils