fix: Use PublicSubnet from stack to run task#2024
fix: Use PublicSubnet from stack to run task#2024mergify[bot] merged 13 commits intoaws:mainlinefrom
Conversation
30d50f5 to
60edf43
Compare
Lou1415926
left a comment
There was a problem hiding this comment.
Hello ota42y! Thank you so much for reporting and fixing the issue 🙇♀️ Really appreciated! I have some small suggestions below.
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
|
I have completed the fix! |
bvtujo
left a comment
There was a problem hiding this comment.
Thank you so much for this change, this will be super helpful. A few comments, nothing major :)
| return tags, nil | ||
|
|
||
| for _, out := range envStack.Outputs { | ||
| if out.OutputKey != nil { |
There was a problem hiding this comment.
Can we use the aws.StringValue() function here to do this comparison? We tend to prefer it to explicit pointer dereference in this codebase. It could be coupled with a switch here as well:
for _, out := range envStack.Outputs {
switch aws.StringValue(out.OutputKey) {
case stack.EnvOutputVPCID:
environmentVPC.ID = aws.StringValue(out.OutputValue)
...
}
}We already import it into the describe package in other files, so it isn't adding a dependency, and it can avoid the extra conditional.
| Environment: testEnv, | ||
| Services: envSvcs, | ||
| Tags: map[string]string{"copilot-application": "testApp", "copilot-environment": "testEnv"}, | ||
| EnvironmentVPC: &EnvironmentVPC{ |
There was a problem hiding this comment.
🙏 thank you so much for these tests!
| } | ||
| if len(subnets) == 0 { | ||
| if description == nil || description.EnvironmentVPC == nil || len(description.EnvironmentVPC.PublicSubnetIDs) == 0 { | ||
| return nil, errNoSubnetFound |
There was a problem hiding this comment.
Can we use a more descriptive error here, since this is wrapping multiple failure modes? Perhaps we could break it out into separate descriptive errors.
There was a problem hiding this comment.
I think we don't need to check description.
Because when description is nil, we'll get error and return above line.
And I don't use pointer for description.EnvironmentVPC .
Because when we can't get data from Stack, we return error so we can set this struct always.
There was a problem hiding this comment.
Got it! Thanks for the follow up!
Co-authored-by: Austin Ely <austiely@amazon.com>
3ef4c6b to
0377970
Compare
When we can't get Stack we'll get error, so this struct always exist.
0377970 to
393e294
Compare
|
I have completed the fix! |
Lou1415926
left a comment
There was a problem hiding this comment.
Thank you so much for the quick turnaround!!
|
Thank you so much for this, @ota42y! A super helpful enhancement. |
This PR is a quick follow up on #2024. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please read this Issue. aws#2022 There was a structure called EnvironmentVPC that was not being used, so we added data to it and returned it when describing the Stack. We also used this information to get PublicSubnet when executing the Task. We can get SecurityGroup from the Stack, but we have not changed it because it is not relevant to this change.
This PR is a quick follow up on aws#2024. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please read this Issue.
#2022
There was a structure called EnvironmentVPC that was not being used, so we added data to it and returned it when describing the Stack.
We also used this information to get PublicSubnet when executing the Task.
We can get SecurityGroup from the Stack, but we have not changed it because it is not relevant to this change.