-
Notifications
You must be signed in to change notification settings - Fork 24
fix(aws): make CIRoleArn output ARN #1854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes extend AWS ECS CloudFormation stack management to support parameterized updates, add CI role ARN output handling, and update the OIDC provider JWK structure with additional RSA cryptographic fields while refining thumbprint extraction logic. Changes
Sequence Diagram(s)sequenceDiagram
participant SetUp
participant upsertStackAndWait
participant CFN as CloudFormation API
participant fillWithOutputs
SetUp->>SetUp: Build parameters<br/>(VPC, RetainBucket, etc.)
SetUp->>upsertStackAndWait: Call with parameters
upsertStackAndWait->>CFN: Attempt UpdateStack
CFN-->>upsertStackAndWait: APIError (stack not found)
alt Stack Exists
upsertStackAndWait->>CFN: UpdateStack succeeds
else Stack Missing
upsertStackAndWait->>CFN: CreateStack
CFN-->>upsertStackAndWait: CreateStack success
end
upsertStackAndWait->>CFN: DescribeStacks (wait for completion)
CFN-->>upsertStackAndWait: Stack outputs
upsertStackAndWait->>fillWithOutputs: Extract outputs
fillWithOutputs->>fillWithOutputs: Map OutputsTaskDefARN<br/>and OutputsCIRoleARN
fillWithOutputs-->>upsertStackAndWait: Populated config
upsertStackAndWait-->>SetUp: Return success
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.5.0)level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter" Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pkg/clouds/aws/ecs/cfn/setup.go (1)
184-200: Allow Docker Hub credentials to be cleared after being set.The current implementation uses
os.Getenv, which treats unset and explicitly empty environment variables identically. This prevents clearing credentials because omitted parameters fall back toUsePreviousValuein CloudFormation updates. Switch toos.LookupEnvto distinguish between unset (preserve previous) and explicitly empty (clear parameter):🔧 Proposed fix
- if dockerHubUsername := os.Getenv("DOCKERHUB_USERNAME"); dockerHubUsername != "" { + if dockerHubUsername, ok := os.LookupEnv("DOCKERHUB_USERNAME"); ok { parameters = append(parameters, cfnTypes.Parameter{ ParameterKey: ptr.String(ParamsDockerHubUsername), ParameterValue: ptr.String(dockerHubUsername), }) } - if dockerHubToken := os.Getenv("DOCKERHUB_ACCESS_TOKEN"); dockerHubToken != "" { + if dockerHubToken, ok := os.LookupEnv("DOCKERHUB_ACCESS_TOKEN"); ok { parameters = append(parameters, cfnTypes.Parameter{ ParameterKey: ptr.String(ParamsDockerHubAccessToken), ParameterValue: ptr.String(dockerHubToken), }) }
🤖 Fix all issues with AI agents
In `@src/pkg/clouds/aws/ecs/cfn/oidc.go`:
- Line 19: The X5c field currently typed as [][]byte will fail to unmarshal JWK
x5c entries (they are JSON strings containing standard base64), so change the
X5c field on the OIDC JWK struct to []string (or []json.RawMessage) and when you
need the DER bytes decode them with base64.StdEncoding.DecodeString (e.g. in the
codepath that inspects key.X5c). Also add the encoding/base64 import and handle
decode errors where you reference X5c so usages of X5c (the commented else-if
branch or any function that reads key.X5c) work correctly.
Description
CIRoleARN CloudFormation output was not an ARN.
Checklist
Summary by CodeRabbit
Tests
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.