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:
pull_request:
branches: [main, dev]
permissions:
contents: read
jobs:
ci:
uses: Sea-Haven-Industries/.github/.github/workflows/ci-dotnet.yaml@main
with:
dotnet-version: "8.0.x"
solution: "SeaHavenIndustries.sln"
run-tests: true
build-and-test:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 20
concurrency:
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 `*`
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
fatal deployment event. The following workflow step therefore verifies that
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(
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['s3:GetObjectAcl'],
// UpdateEnvironment also checks objects in AWS-owned Elastic Beanstalk
// buckets. AWS Support case 178526484500047 confirmed that the caller's
// identity policy must cover the service-wide bucket namespace.
actions: ['s3:DeleteObject', 's3:GetObjectAcl'],
// UpdateEnvironment also checks and removes temporary objects in
// AWS-owned Elastic Beanstalk buckets. AWS Support case
// 178526484500047 confirmed that the caller's identity policy must
// cover the service-wide bucket namespace.
resources: ['arn:aws:s3:::elasticbeanstalk-*/*'],
}),
);