fix(scripts): detect failures in publish_bottlecap_sandbox.sh#1191
fix(scripts): detect failures in publish_bottlecap_sandbox.sh#1191lucaspimentel merged 1 commit intomainfrom
publish_bottlecap_sandbox.sh#1191Conversation
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
publish_bottlecap_sandbox.sh
There was a problem hiding this comment.
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_VERSIONand fail fast with an explicitERROR:when publish output is empty/null. - Quote
$ARCHITECTURE/$REGIONusages to avoid shell parsing issues.
| @@ -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 | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
thanks, but that's out of scope for this PR
publish_bottlecap_sandbox.shpublish_bottlecap_sandbox.sh
Overview
publish_bottlecap_sandbox.shwould printeven when the
aws-vault/awscall failed, because pipeline failures were not propagated andNEW_VERSIONwas silently empty.Changes:
set -ewithset -eo pipefailso any failure in theaws-vault | jqpipeline aborts the script immediatelyNEW_VERSIONis empty ornullafter the publish call, printERROR:and exit 1 instead of a misleading success message$ARCHITECTURE,$REGIONvariables (shellcheck warnings)Testing
Verified locally by running the script without
awsin$PATH— the script now exits withERROR: Failed to publish layer ...instead ofDONE: Published version of layer ....