mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
BuildKite: Print Docker daemon configuration whenever it is modified/reloaded.
Also don't completely remove the `runtimes` object from the JSON configuration during `post-command`; instead, replace it with an empty one. Reloading Docker versions with an empty one is apparently different than reloading it with no `runtimes` at all. PiperOrigin-RevId: 514494269
This commit is contained in:
committed by
gVisor bot
parent
38189969f2
commit
eb5b888d97
@@ -87,9 +87,11 @@ if [[ "${BUILDKITE_PIPELINE_INSTALL_RUNTIME:-}" == "true" ]]; then
|
||||
'(if has("runtimes") then .runtimes else {} end) | length' \
|
||||
< /etc/docker/daemon.json)"
|
||||
if [[ "$num_docker_runtimes" -gt 0 ]]; then
|
||||
cat /etc/docker/daemon.json | jq 'del(.runtimes)' \
|
||||
cat /etc/docker/daemon.json | jq '.runtimes = {}' \
|
||||
| sudo tee /etc/docker/daemon.json.tmp
|
||||
sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
|
||||
echo 'Removed all Docker runtimes; reloading Docker daemon with this new configuration:' >&2
|
||||
cat /etc/docker/daemon.json >&2
|
||||
bash -c "$DOCKER_RELOAD_COMMAND"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -49,7 +49,9 @@ fi
|
||||
|
||||
if [[ "${BUILDKITE_PIPELINE_INSTALL_RUNTIME:-}" == "true" ]]; then
|
||||
# Ensure Docker has experimental enabled, install runtimes.
|
||||
HAD_EXPERIMENTAL="$(docker version --format='{{.Server.Experimental}}')"
|
||||
echo 'Current Docker daemon configuration:' >&2
|
||||
cat /etc/docker/daemon.json >&2
|
||||
HAD_EXPERIMENTAL="$(cat /etc/docker/daemon.json | jq '.experimental')"
|
||||
if [[ -n "${STAGED_BINARIES:-}" ]]; then
|
||||
# Used `runsc` from STAGED_BINARIES instead of building it from scratch.
|
||||
export BUILDKITE_STAGED_BINARIES_DIRECTORY="$(mktemp -d)"
|
||||
@@ -57,20 +59,24 @@ if [[ "${BUILDKITE_PIPELINE_INSTALL_RUNTIME:-}" == "true" ]]; then
|
||||
| tar -C "$BUILDKITE_STAGED_BINARIES_DIRECTORY" -zxvf - runsc
|
||||
chmod +x "$BUILDKITE_STAGED_BINARIES_DIRECTORY/runsc"
|
||||
sudo "$BUILDKITE_STAGED_BINARIES_DIRECTORY/runsc" install \
|
||||
--experimental=true --runtime="${RUNTIME}" \
|
||||
-- "${RUNTIME_ARGS:-}"
|
||||
--experimental=true --runtime="${RUNTIME}" \
|
||||
-- "${RUNTIME_ARGS:-}"
|
||||
else
|
||||
make sudo TARGETS=//runsc:runsc \
|
||||
ARGS="install --experimental=true --runtime=${RUNTIME} -- ${RUNTIME_ARGS:-}"
|
||||
fi
|
||||
if [[ "$HAD_EXPERIMENTAL" == false ]]; then
|
||||
if [[ "$HAD_EXPERIMENTAL" != true ]]; then
|
||||
# WARNING: We may be running in a container when this command executes.
|
||||
# This only makes sense if Docker's `live-restore` feature is enabled.
|
||||
echo 'Restarting Docker daemon with this new configuration:' >&2
|
||||
cat /etc/docker/daemon.json >&2
|
||||
sudo systemctl restart docker
|
||||
else
|
||||
# If experimental-ness was already enabled, we don't need to restart, as the
|
||||
# only thing we modified is the list of runtimes, which can be reloaded with
|
||||
# just a SIGHUP.
|
||||
echo 'Reloading Docker daemon with this new configuration:' >&2
|
||||
cat /etc/docker/daemon.json >&2
|
||||
bash -c "$DOCKER_RELOAD_COMMAND"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user