-
Notifications
You must be signed in to change notification settings - Fork 825
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
fix: eliminate circular dependency when generating CMS assets #11304
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## dev #11304 +/- ##
==========================================
+ Coverage 49.60% 49.61% +0.01%
==========================================
Files 683 682 -1
Lines 32840 32827 -13
Branches 6700 6693 -7
==========================================
- Hits 16290 16287 -3
+ Misses 15070 15061 -9
+ Partials 1480 1479 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
srquinn21
reviewed
Nov 2, 2022
edwardfoyle
commented
Nov 2, 2022
@@ -72,9 +78,20 @@ export const getBucketKeys = async (params: S3.ListObjectsRequest) => { | |||
} | |||
}; | |||
|
|||
export const getDeploymentBucketObject = async (projectRoot: string, objectKey: string) => { |
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.
This is the only functional change in this file. Everything else is lint fixes
jhockett
suggested changes
Nov 2, 2022
packages/amplify-provider-awscloudformation/src/admin-modelgen.ts
Outdated
Show resolved
Hide resolved
jhockett
previously approved these changes
Nov 2, 2022
lazpavel
reviewed
Nov 2, 2022
packages/amplify-provider-awscloudformation/src/admin-modelgen.ts
Outdated
Show resolved
Hide resolved
lazpavel
approved these changes
Nov 3, 2022
jhockett
approved these changes
Nov 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
When Amplify Studio is enabled on a project, after push, the CLI calls AmplifyBackend.generateBackendAPIModels. This in turn would execute some codegen commands via the CLI running in Studio and upload output assets to S3. This generated a circular dependency which apart from being a confusing antipattern also caused failures like #11284.
This PR fixes the issue by removing the call to AmplifyBackend.generateBackendAPIModels altogether. Instead after push the CLI invokes the necessary codegen commands and uploads the assets to S3 directly.
While this simplifies the overall architecture of this code path, this implementation required a few hacks:
Additionally, there is tight coupling between Studio CMS and the CLI via the expected S3 paths of the CMS assets. However, this tight coupling is not new, it's just been moved from Studio to the CLI.
Issue #, if available
fixes #11284
Description of how you validated changes
Validated manually, added unit tests and e2e test
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.