-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(ecr): allow fromLookup
method to return dummy repository without error if target repository was not found
#34030
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
Conversation
… error if target repository was not found
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #34030 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 120 120
Lines 6976 6976
Branches 1178 1178
=======================================
Hits 5859 5859
Misses 1005 1005
Partials 112 112
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
(my concerns are summarized below)
mustExist: false, | ||
}); | ||
|
||
if (ecr.Repository.isLookupDummy(dummy)) { |
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.
I think I'd rather have a new lookup function that returns IRepository | undefined
.
That new lookup function would also be a perfect place to attach disclaimers that I'm 99% sure most users will not expect, such as:
- The result of this lookup is cached in context at the time of
synth
. Therefore:- You must have access to all environments you want to deploy this to at synth time
- The lookup does not run at deploy time, so if the repository gets created/deleted between synth time and deploy time, the behavior will be not what you expect.
- After one successful synth, if a user regrets the decision and want to change it (i.e., externally delete/create the resource), the user has clear the context entry before trying again.
I'm sure there's more that I can't think of right now.
Are we 100% confident offering this feature will lead to a good user experience? Because I'm concerned it will end up being a footgun.
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.
Hmmm... You have a point, maybe we can't be 100% sure...
I'll drop this PR for now. If I get another good idea I might reopen it.
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #34031
Reason for this change
The
fromLookup
method causes an error if the target repository was not found. However it would be also good not to cause an error and to return dummy value in that case.Now, with the PR merged in aws-cdk-cli ([email protected]), we can ignore errors and return dummy value with
mustExist
option in CC API Provider.Description of changes
mustExist
option inRepositoryLookupOptions
.mustExist
forContextProvider.getValue
isLookupDummy
method to check whether the repository is dummy.ref PR:
fromLookup
method to return dummy key if target key was not found #31676isLookupDummy
method.feat(iam): supportRole.fromLookup()
method #33603This lookup method uses cc-api provider and includes theisLookupDummy
method too.Describe any new or updated permissions being added
Description of how you validated changes
Both unit and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license