Skip to content

Fix the shutdown hook and add CI for both examples - #3

Merged
HarshCasper merged 2 commits into
mainfrom
ci/assert-init-hooks
Oct 13, 2026
Merged

HarshCasper merged 2 commits into
mainfrom
ci/assert-init-hooks

Conversation

@HarshCasper

@HarshCasper HarshCasper commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

The repo had no CI, and both examples were broken on current LocalStack images.

Fixes:

  • Init scripts no longer get AWS settings from the image, so the hooks failed with "You must specify a region" and "Unable to locate credentials". All three hooks now default to us-east-1 and the test credentials.
  • The shell hooks use set -eo pipefail. Before, init-vpc.sh was reported as SUCCESSFUL even when every command failed.
  • Images no longer ship the localstack CLI at /opt/code/localstack/.venv/bin/localstack, so save-pod.sh now exports state through the /_localstack/pods/state endpoint with curl.

Tests:

  • example-localstack-cli/test.sh checks init-vpc.sh succeeded, the MyVPC VPC exists, and it has 3 isolated subnets.
  • example-docker-compose/test.sh checks the init hooks ran, the secret holds hello-there, and both SSM parameters exist.
  • READMEs updated. The import step uses lstk load ./volume/my-pod.zip.
  • New workflow with two jobs:
    • lstk: start LocalStack in example-localstack-cli and run its test.
    • compose: start the compose stack, run its test, stop it, check the shutdown hook wrote my-pod.zip, then load it into a fresh LocalStack and check the secret survived.

Verified by CI, since the examples bind the same ports as a running LocalStack.

https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM

Current images do not pass AWS settings to init scripts, so the aws CLI failed with 'You must specify a region' and boto3 with 'Unable to locate credentials'. Fail the shell hooks on the first error so a broken hook is not reported as successful.

Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
@HarshCasper
HarshCasper merged commit 8e1c869 into main Oct 13, 2026
2 checks passed
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.

1 participant