Skip to content

fix(scripts): detect failures in publish_bottlecap_sandbox.sh#1191

Merged
lucaspimentel merged 1 commit intomainfrom
lpimentel/fix-publish-bottlecap-sandbox
Apr 17, 2026
Merged

fix(scripts): detect failures in publish_bottlecap_sandbox.sh#1191
lucaspimentel merged 1 commit intomainfrom
lpimentel/fix-publish-bottlecap-sandbox

Conversation

@lucaspimentel
Copy link
Copy Markdown
Member

@lucaspimentel lucaspimentel commented Apr 17, 2026

Overview

publish_bottlecap_sandbox.sh would print

DONE: Published version  of layer ...

even when the aws-vault/aws call failed, because pipeline failures were not propagated and NEW_VERSION was silently empty.

Changes:

  • Replace set -e with set -eo pipefail so any failure in the aws-vault | jq pipeline aborts the script immediately
  • Add explicit validation: if NEW_VERSION is empty or null after the publish call, print ERROR: and exit 1 instead of a misleading success message
  • Fix unquoted $ARCHITECTURE, $REGION variables (shellcheck warnings)

Testing

Verified locally by running the script without aws in $PATH — the script now exits with ERROR: Failed to publish layer ... instead of DONE: Published version of layer ....

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
@lucaspimentel lucaspimentel changed the title Fix publish_bottlecap_sandbox.sh failure detection fix: detect failures in publish_bottlecap_sandbox.sh Apr 17, 2026
@lucaspimentel lucaspimentel marked this pull request as ready for review April 17, 2026 17:09
@lucaspimentel lucaspimentel requested a review from a team as a code owner April 17, 2026 17:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves reliability of the scripts/publish_bottlecap_sandbox.sh publishing flow by preventing misleading “DONE” output when the AWS publish pipeline fails or returns an invalid version.

Changes:

  • Enable pipeline failure detection via set -eo pipefail.
  • Validate NEW_VERSION and fail fast with an explicit ERROR: when publish output is empty/null.
  • Quote $ARCHITECTURE/$REGION usages to avoid shell parsing issues.

Comment on lines 17 to 30
@@ -24,7 +24,7 @@ _init_arg(){
LAYER_PATH=".layers/datadog_extension-arm64.zip"
LAYER_NAME="Datadog-Bottlecap-Beta-ARM"
fi
if [ -z $ARCHITECTURE ]; then
if [ -z "$ARCHITECTURE" ]; then
echo "No architecture specified, defaulting to amd64"
ARCHITECTURE="amd64"
fi
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In _init_arg, the defaulting of ARCHITECTURE to amd64 happens after the logic that sets LAYER_PATH/LAYER_NAME based on ARCHITECTURE. When ARCHITECTURE is unset/empty, this will leave LAYER_PATH and LAYER_NAME empty even though the script prints that it’s defaulting to amd64. Consider defaulting ARCHITECTURE first (or using a single case with a default branch) so the layer path/name are always initialized consistently.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, but that's out of scope for this PR

@duncanista duncanista changed the title fix: detect failures in publish_bottlecap_sandbox.sh fix(scripts): detect failures in publish_bottlecap_sandbox.sh Apr 17, 2026
@lucaspimentel lucaspimentel merged commit 3998e88 into main Apr 17, 2026
54 of 56 checks passed
@lucaspimentel lucaspimentel deleted the lpimentel/fix-publish-bottlecap-sandbox branch April 17, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants