Skip to content

Conversation

@steffyP
Copy link
Member

@steffyP steffyP commented Jan 27, 2026

As currently the API for ephemeral instances is known to be unstable, this PR aims to make to retry failing API calls and to capture additional logs in case of failure cases.
This way it will be easier to pinpoint issues in the future.

Example logs:

...
curl command failed while fetching instances. Response: {"error": true, "message": "compute.general_error"}
Command failed with exit code 1. Retrying in 5 seconds... (1/5)
Creating preview environment ...
Created preview environment with endpoint URL: https://ls-4ra30eqlofl88.sandbox.localstack.cloud/
...
Fetching logs for preview-localstack-setup-localstack-61 ...
Instance is not ready yet, waiting for 'Ready.' message in logs...
Command failed with exit code 1. Retrying in 5 seconds... (1/5)
preview-localstack-setup-localstack-61 logs:
Localstack extensions installer: installing extensions defined EXTENSIONS_AUTO_INSTALL
....

changes:

  • retry failing API call up to 5 times, with a 5 second waiting time in between (no guarantee this is enough, but it was sufficient for our CI and we have the logs for debugging issues)
  • log details (e.g. retry, the actual response)
  • added a helper script that will be loaded so that we can reuse the function
  • added additional check to make sure that logs are successfully retrieved

Suggested future work (once the API is stable):

  • rather use the localstack CLI than hardcoding the API calls, as any changes to the API will need changes to the action as well
    • As @lukqw pointed out the CLI may not have the capabilities of handling ENVs that have been set (regarding autoloading of pods, extensions etc).
  • add more tests, e.g. some attributes are currently not tested or verified: auto-load-pod, ci-project

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

The ephemeral instance for the application preview has been shut down

@steffyP steffyP changed the title test retry loops to create ephemeral instances add retries for ephemeral instance api calls Jan 29, 2026
Comment on lines +3 to +6
pull_request:
paths-ignore:
- ./*.md
- LICENSE
Copy link
Member Author

Choose a reason for hiding this comment

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

removing the workflow_dispatch that I added in a previous PR, as it doesn't make sense with the logic that the ephemeral instances are currently following (e.g. searching for the PR number and adding comment to the PR)

description: 'LocalStack API key used to access the platform api'
required: true
description: 'LocalStack Auth Token used to access the platform api'
required: false
Copy link
Member Author

Choose a reason for hiding this comment

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

the localstack-api-key is not documented, neither is it required or currently used in our own CI test. It is a fallback in case the LOCALSTACK_AUTH_TOKEN and LOCALSTACK_API_KEY are not set

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, that's a good point! That's maybe something to revisit in the future. The term is outdated (we only have auth tokens now) and it seems a bit confusing to configure...

@steffyP steffyP marked this pull request as ready for review January 29, 2026 17:34
@steffyP steffyP requested a review from alexrashed January 29, 2026 17:34
Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing the usage of ephemeral instances by implementing the retry logic!
From my perspective this is looking great. I think there is potential to move this to the CLI and reuse it here in the future, but that would definitely be out of scope for this PR!

Given that @lukqw is the expert on ephemeral instances and also has contributed to this feature in the action in the past, I think it might be good to maybe also get a quick review from you as well? 🙏🏽

description: 'LocalStack API key used to access the platform api'
required: true
description: 'LocalStack Auth Token used to access the platform api'
required: false
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, that's a good point! That's maybe something to revisit in the future. The term is outdated (we only have auth tokens now) and it seems a bit confusing to configure...

# retry() function: Retries a given command up to 'retries' times with a 'wait' interval.
# Usage: retry <command>
# Example: retry my_api_call_function
retry() {
Copy link
Member

Choose a reason for hiding this comment

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

@lukqw I think this is where your input would really be valuable. Is this retry mechanism what you would expect a client to do if they get a failure response from the ephemeral instance API?
This effectively would be a classic retry machanism, 5 retries, 5 seconds constant backoff.

@alexrashed alexrashed requested a review from lukqw January 30, 2026 09:28
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