-
Notifications
You must be signed in to change notification settings - Fork 434
feat: enable multideployments #5324
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
Co-authored-by: Janice Huang <60631893+huanjani@users.noreply.github.com>
| name: workload, | ||
| cmd: deployCmd, | ||
| }) | ||
| if err := deployCmd.Ask(); err != nil { |
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.
Am I correct that we would be prompting "which environment do you want to deploy xxx to" for each service xxx?
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.
No, env gets asked once, separately, early on in Run(). Then, when loadWkldCmd gets called, it uses the env value provided earlier to populate that variable in each individual command. Ask() is really there to catch esoteric less-used flags that are workload specific.
internal/pkg/cli/deploy.go
Outdated
| count := 0 | ||
| for i := 0; i < len(cmds); i++ { | ||
| count += len(cmds[i]) |
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 guess we could also have count defined earlier, and increment it while we loop through each deploymentOrderGroup (the nested for-loop above), just to have one less for-loop iteration (not a huge difference though)
internal/pkg/cli/deploy.go
Outdated
| } | ||
| if err := o.deployWkld.RecommendActions(); err != nil { | ||
| return err | ||
| log.Infof("Will deploy %d %s in the following order.\n", count, english.PluralWord(count, "workload", "")) |
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.
Nice information here!
| } | ||
|
|
||
| func parseDeploymentOrderTags(namesWithOptionalOrder []string) (map[string]int, error) { | ||
| prioritiesMap := make(map[string]int) |
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.
Why do we use "priorities" instead of "orders" here?
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 a first step to parallelizing deployments--the idea is to create multiple groups which may be deployed in parallel, and then deploy those groups in a prescribed order. I wanted to use a different word to distinguish this, which is a precursor data structure, from the final.
|
🍕 Here are the new binary sizes!
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## mainline #5324 +/- ##
============================================
+ Coverage 69.82% 69.86% +0.03%
============================================
Files 296 297 +1
Lines 44835 45020 +185
Branches 287 287
============================================
+ Hits 31307 31453 +146
- Misses 12009 12038 +29
- Partials 1519 1529 +10
☔ View full report in Codecov by Sentry. |
| if o.yesInitWkld == nil { | ||
| confirmInitWkld, err := o.prompt.Confirm(fmt.Sprintf("Found manifest for uninitialized %s %q. Initialize it?", workloadType, name), "This workload will be initialized, then deployed.", prompt.WithFinalMessage(fmt.Sprintf("Initialize %s:", workloadType))) |
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.
Just curious, why do we remove this prompt? (I don't have an opinion on this yeet, just curious)
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.
@dannyrandall made a great comment in bugbash feedback that simply specifying an un-initialized service is sufficient to divine the customer's intent to init it. This changes makes --init-wkld into a flag which specifically modifies the behavior of --all. That is, when --all and --init-wkld are true, copilot deploy will initialize and deploy everything in the ws. But when --init-wkld is false or unspecified, we'll only deploy initialized workloads.
internal/pkg/cli/deploy.go
Outdated
| } | ||
|
|
||
| // Pop removes the last element from the array. | ||
| func (p *pq) Pop() any { |
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.
Not a request for this PR, but I feel like ideally we'd have a separate file / package for this and have some unit tests implemented on it! Edit: oops, nvm, I think we don't need that at all. This is just to satisfy the interface that the heap package wants.
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.
lmao too late I already wrote a generic priority queue
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.
Just a few more comments!
| } | ||
|
|
||
| for g, deploymentGroup := range cmds { | ||
| // TODO parallelize this. Steps involve: |
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.
❤️
internal/pkg/cli/deploy.go
Outdated
| // FilterItemsByStrings(wantedStrings, stringSlice2, func(s string) string { return s }) | ||
| // | ||
| // It returns a list of strings (items whose stringFunc() exists in the list of wantedStrings). | ||
| func FilterItemsByStrings[T any](wantedStrings []string, possibleItems []T, stringFunc func(T) string) []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.
| func FilterItemsByStrings[T any](wantedStrings []string, possibleItems []T, stringFunc func(T) string) []string { | |
| func filterItemsByStrings[T any](wantedStrings []string, possibleItems []T, stringFunc func(T) string) []string { |
internal/pkg/cli/deploy.go
Outdated
| // func(w *config.Workload) string { return w.Name } | ||
| // | ||
| // as the stringFunc parameter. | ||
| func FilterOutItems[T any](allItems []string, unwantedItems []T, stringFunc func(T) string) []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.
| func FilterOutItems[T any](allItems []string, unwantedItems []T, stringFunc func(T) string) []string { | |
| func filterOutItems[T any](allItems []string, unwantedItems []T, stringFunc func(T) string) []string { |
| cmd.Flags().BoolVar(&deployEnvironment, deployEnvFlag, false, deployEnvFlagDescription) | ||
| cmd.Flags().BoolVar(&initEnvironment, yesInitEnvFlag, false, yesInitEnvFlagDescription) | ||
| cmd.Flags().BoolVar(&initWorkload, yesInitWorkloadFlag, false, yesInitWorkloadFlagDescription) | ||
| cmd.Flags().BoolVar(&vars.yesInitWkld, yesInitWorkloadFlag, false, yesInitWorkloadFlagDescription) |
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.
Is the default true?
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.
no, I think we should err on the side of only deploying initted local workloads unless the customer opts in.
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.
🎉
Adds multideployments and an --all flag. Customers can now specify a deployment order tag with their workload names, eg. "fe/1,be/2" to deploy services in a particular order. Shared numbers create a deployment group, which can be parallelized in the future. tk: unit tests for new behavior By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
Adds multideployments and an --all flag.
Customers can now specify a deployment order tag with their workload names, eg. "fe/1,be/2" to deploy services in a particular order.
Shared numbers create a deployment group, which can be parallelized in the future.
tk: unit tests for new behavior
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.