Send the stack that a failed deployment created - #64
Merged
Merged
Conversation
Bref Cloud only knew the stack of a serverless.yml deployment once it succeeded: removing an environment whose deployments all failed left their stack in the AWS account. Claude-Session: https://claude.ai/code/session_01Awk33iZ9mDSg1xgSAPkgGK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A
serverless.ymldeployment only tells Bref Cloud its stack once it succeeds: the stack name and region come fromserverless info, which the CLI runs after a successfulserverless deploy.When the first deployment of an environment fails in CloudFormation, the stack exists (usually in
UPDATE_ROLLBACK_COMPLETE, with its deployment bucket), but Bref Cloud doesn't know about it. Removing the environment then leaves the stack and its bucket in the AWS account, with nothing in Bref Cloud pointing to them any more.Change
When
serverless deployfails, the CLI looks in the osls output for the stack that this deployment created, and sends its name and region with the failed deployment. Bref Cloud already accepts and stores them for a failed deployment, so no change is needed there: removing the environment deletes the stack, as for an environment deployed successfully.The CLI runs osls with
--verbose, which logs the events of the stack. The first stack event is the stack's own:CREATE_IN_PROGRESS: osls created the stack, so this deployment created it. It is sent.UPDATE_IN_PROGRESS: the stack already existed, e.g. deployed with the Serverless Framework before moving to Bref Cloud. Nothing is sent, so removing the environment doesn't delete a stack that Bref Cloud didn't create.Also:
provider.stackName.Deploying <service> to stage <stage> (<region>), also whenserverless.ymldoesn't setprovider.region.Tests
ServerlessFrameworkTestfinds the stack in:Bref Cloud
Bref Cloud already handles an environment that has a stack but no successful deployment:
bref.phpdeployments record the stack name before CloudFormation runs. The environment page doesn't report the stack as missing until a deployment succeeds, and removing the environment empties the stack's buckets and deletes the stack (checked against a stack inUPDATE_ROLLBACK_COMPLETEwith its deployment bucket).Not tested end to end with this change, nor with osls@4 (same log lines according to its source). If the lines aren't found, nothing is sent, as before.