From a14d24bd650df793edbfbf82a0fae4e2705d0061 Mon Sep 17 00:00:00 2001 From: Michael Xiao Date: Mon, 24 Aug 2026 11:44:12 -0400 Subject: [PATCH 1/2] Report cache build status before stopping docker --- startupscript/butane/prepare-devcontainer-cache.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/startupscript/butane/prepare-devcontainer-cache.sh b/startupscript/butane/prepare-devcontainer-cache.sh index b2b9027db..8d8641ab6 100755 --- a/startupscript/butane/prepare-devcontainer-cache.sh +++ b/startupscript/butane/prepare-devcontainer-cache.sh @@ -59,6 +59,15 @@ if [[ -n "${DOCKER_DIR+x}" ]]; then popd fi +# Report success before docker is stopped. On AWS set_metadata tags the instance +# by running the AWS CLI in a container, so it cannot run once the docker daemon +# is gone. The steps below are covered by errexit and the OnFailure handler, and +# the cache builder only captures a cache once the instance has also powered +# itself off, so reporting here cannot turn a failed build into a successful one. +# shellcheck source=/dev/null +source '/home/core/metadata-utils.sh' +set_metadata 'startup_script/status' "COMPLETED" + # Stop docker and prevent it from starting again systemctl mask docker systemctl stop docker @@ -74,9 +83,5 @@ find /var/lib/docker \ ! -name engine-id \ -exec rm -rf {} + -# shellcheck source=/dev/null -source '/home/core/metadata-utils.sh' -set_metadata 'startup_script/status' "COMPLETED" - # Shut down the instance to signal that the image is ready to be saved. systemctl poweroff From 33fa167a60a205254f69665d829d3f8ffd90f1cd Mon Sep 17 00:00:00 2001 From: Michael Xiao Date: Thu, 27 Aug 2026 09:54:50 -0400 Subject: [PATCH 2/2] Shorten the status-ordering comment --- startupscript/butane/prepare-devcontainer-cache.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/startupscript/butane/prepare-devcontainer-cache.sh b/startupscript/butane/prepare-devcontainer-cache.sh index 8d8641ab6..9d935e95f 100755 --- a/startupscript/butane/prepare-devcontainer-cache.sh +++ b/startupscript/butane/prepare-devcontainer-cache.sh @@ -61,9 +61,7 @@ fi # Report success before docker is stopped. On AWS set_metadata tags the instance # by running the AWS CLI in a container, so it cannot run once the docker daemon -# is gone. The steps below are covered by errexit and the OnFailure handler, and -# the cache builder only captures a cache once the instance has also powered -# itself off, so reporting here cannot turn a failed build into a successful one. +# is gone. # shellcheck source=/dev/null source '/home/core/metadata-utils.sh' set_metadata 'startup_script/status' "COMPLETED"