fix(eb): allow temporary object cleanup

This commit is contained in:
brandizzi 2026-07-30 12:04:13 -03:00
parent 160d733e2b
commit 9733677d7f
3 changed files with 42 additions and 11 deletions

View file

@ -1,11 +1,34 @@
name: Backend build and tests name: Backend CI
on: on:
pull_request: pull_request:
branches: [main, dev] branches: [main, dev]
permissions:
contents: read
jobs: jobs:
ci: build-and-test:
uses: Sea-Haven-Industries/.github/.github/workflows/ci-dotnet.yaml@main name: Build and test
with: runs-on: ubuntu-latest
dotnet-version: "8.0.x" timeout-minutes: 20
solution: "SeaHavenIndustries.sln" concurrency:
run-tests: true group: backend-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "8.0.x"
- name: Restore
run: dotnet restore SeaHavenIndustries.sln
- name: Build
run: dotnet build SeaHavenIndustries.sln --no-restore --configuration Release
- name: Test
run: dotnet test SeaHavenIndustries.sln --no-build --configuration Release

View file

@ -216,6 +216,13 @@ discovery using the initiating role, so the CDK policy includes that action
alongside the existing EC2 describe permissions. It remains resource `*` alongside the existing EC2 describe permissions. It remains resource `*`
because `DescribeVpcs` does not support resource-level permissions. because `DescribeVpcs` does not support resource-level permissions.
After that permission was deployed, the next exact rerun reached the S3 cleanup
phase and failed because Elastic Beanstalk could not delete one or more
temporary objects. The service does not expose the AWS-owned bucket/key in its
event, so `s3:DeleteObject` is scoped to the same AWS-confirmed
`arn:aws:s3:::elasticbeanstalk-*/*` object namespace as `GetObjectAcl`. The
policy does not grant wildcard S3 actions or access to non-Beanstalk buckets.
The pinned deployment action can return success after Elastic Beanstalk emits a The pinned deployment action can return success after Elastic Beanstalk emits a
fatal deployment event. The following workflow step therefore verifies that fatal deployment event. The following workflow step therefore verifies that
the exact immutable version label is active and healthy before smoke testing. the exact immutable version label is active and healthy before smoke testing.

View file

@ -210,10 +210,11 @@ export class DeployDevStack extends cdk.Stack {
deployRole.addToPolicy( deployRole.addToPolicy(
new iam.PolicyStatement({ new iam.PolicyStatement({
effect: iam.Effect.ALLOW, effect: iam.Effect.ALLOW,
actions: ['s3:GetObjectAcl'], actions: ['s3:DeleteObject', 's3:GetObjectAcl'],
// UpdateEnvironment also checks objects in AWS-owned Elastic Beanstalk // UpdateEnvironment also checks and removes temporary objects in
// buckets. AWS Support case 178526484500047 confirmed that the caller's // AWS-owned Elastic Beanstalk buckets. AWS Support case
// identity policy must cover the service-wide bucket namespace. // 178526484500047 confirmed that the caller's identity policy must
// cover the service-wide bucket namespace.
resources: ['arn:aws:s3:::elasticbeanstalk-*/*'], resources: ['arn:aws:s3:::elasticbeanstalk-*/*'],
}), }),
); );