Open coolloic opened 1 month ago
Hey @coolloic,
Serverless Framework’s cleanup phase doesn’t remove the deployment bucket itself - it only deletes objects from the bucket if there are more than service.provider.deploymentBucketObject.maxPreviousDeploymentArtifacts
(default is 5).
Could you clarify in what case you're seeing the S3 deployment bucket being removed when running the deploy
command?
Issue description
Framework Version:
serverless@4.11.1
Plugin(s):
serverless-python-requirements
CI/CD Environment:
CircleCI
Description
When deploying a Lambda layer using
serverless deploy
, the CI/CD pipeline continues successfully even if CloudFormation returns aBucketNotEmpty
error during the cleanup phase.This behavior is different from Serverless v3, which would fail the deploy step and terminate the pipeline if it couldn't delete the deployment bucket due to remaining artefacts.
Expected Behavior
Serverless v4 should fail the deployment if:
It cannot delete the S3 bucket during cleanup due to BucketNotEmpty.
deleteObjects did not clear all old artifacts (only if it's the new deployment strategy, otherwise, it should be aligned with serverless v3 behaviour).
This ensures visibility of cleanup failure and prevents CI from proceeding under a false-positive status.
Actual Behavior
serverless deploy
does not fail.Context
No response