Skip to content

chore(ecs): describe job and generate run task request from job workload#2246

Merged
mergify[bot] merged 20 commits intoaws:mainlinefrom
Lou1415926:generate/job
May 10, 2021
Merged

chore(ecs): describe job and generate run task request from job workload#2246
mergify[bot] merged 20 commits intoaws:mainlinefrom
Lou1415926:generate/job

Conversation

@Lou1415926
Copy link
Copy Markdown
Contributor

@Lou1415926 Lou1415926 commented Apr 30, 2021

This PR implement the function to generate a run task request from a deployed job, and the functions to support it.

This PR is rebased from #2201 (which is not merged yet). The real changes to this PR are at

  • ecs/run_task_request.go (where the information needed to generated a task run command is grabbed from a Copilot job)
  • ecs/run_task_request_test.go
  • aws/stepfunctions/* (where the client to make API calls to stepfunctions is implemented)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Comment thread internal/pkg/cli/flag.go Outdated
taskImageTagFlagDescription = `Optional. The container image tag in addition to "latest".`
taskImageTagFlagDescription = `Optional. The container image tag in addition to "latest".`
generateCommandFlagDescription = `Optional. Generate a command with a pre-filled value for each flag.
To use a non-Copilot ECS service, specify --generate-cmd <cluster name>/<service name>.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: we have fully surfaced the term "workload" to users at this point, right? If so, use "workload" here and in the next line instead of "service"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I should update the flag description in this PR. I'd refrain from using the keyword workload because it doesn't appear anywhere formally in our doc site. I will just say "service or job".

The changes to flag.go in this PR is a result of #2201. I will rebase this branch to mainline once that one is merged.
The real changes in this PR are located at ecs/run_task_request.go and aws/stepfunctions.

Comment thread internal/pkg/cli/task_run.go Outdated
return nil, fmt.Errorf("generate task run command from service: %w", err)
}
default:
return nil, errors.New("invalid input to --generate-cmd: must be of the form <cluster>/<service> or <app>/<env>/<workload>")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above: "workload" instead of "service" for the non-Copilot part of the error message?

Lou1415926 and others added 2 commits May 7, 2021 12:47
Proceeding PR: aws#2266 

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
@Lou1415926 Lou1415926 marked this pull request as ready for review May 7, 2021 21:30
@Lou1415926 Lou1415926 requested a review from a team as a code owner May 7, 2021 21:30
toricls and others added 3 commits May 8, 2021 17:20
<!-- Provide summary of changes -->

This PR is a continued work from aws#2225 by @efekarakus, and adds localized docs for Japanese language in our docs 🚀

Note that the localized docs are translated from the v1.6 Copilot docs - https://github.com/aws/copilot-cli/tree/v1.6.0/site, and are not from the mainline branch.

<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.11.0...v1.12.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.30 to 1.38.36.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md)
- [Commits](aws/aws-sdk-go@v1.38.30...v1.38.36)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@bvtujo bvtujo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good! Some nits about the custom unmarshaler for that deeply nested struct, however!

Comment thread internal/pkg/cli/flag.go Outdated
taskImageTagFlagDescription = `Optional. The container image tag in addition to "latest".`
generateCommandFlagDescription = `Optional. Generate a command with a pre-filled value for each flag.
To use a non-Copilot ECS service, specify --generate-cmd <cluster name>/<service name>.
To use a Copilot service, specify --generate-cmd <application>/<environment>/<service>.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we update this language to include jobs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address in next PR!

Comment thread internal/pkg/cli/task_run.go Outdated
Comment thread internal/pkg/ecs/ecs.go

type NetworkConfiguration ecs.NetworkConfiguration

func (n *NetworkConfiguration) UnmarshalJSON(b []byte) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we edit this comment to make sure that it clarifies what kind of byte stream we expect? Because this unmarshaling logic is quite deeply nested we should be careful to clarify that this unmarshals just the network configuration from inside the DescribeStateMachineDefinition response.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Comment thread internal/pkg/ecs/ecs.go
ecsClient ecsClient
rgGetter resourceGetter
ecsClient ecsClient
StepFuncClient stepFunctionsClient
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this client need to be exported?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't since they will be initialized by New(sess) so that the caller do not need to initialize these fields individually across package.

Although I think we could probably refactor this such that the clients are initialized from the caller (seems like a better approach to me) - in which case they will need to be exported.

@Lou1415926 Lou1415926 added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label May 10, 2021
Copy link
Copy Markdown
Contributor

@huanjani huanjani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Lou1415926 Lou1415926 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label May 10, 2021
@mergify mergify Bot merged commit 904dd44 into aws:mainline May 10, 2021
patnolanireland pushed a commit to patnolanireland/copilot-cli that referenced this pull request May 12, 2021
…oad (aws#2246)

This PR implement the function to generate a run task request from a deployed job, and the functions to support it.

This PR is rebased from aws#2201 (which is not merged yet). The real changes to this PR are at 
- `ecs/run_task_request.go` (where the information needed to generated a `task run` command is grabbed from a Copilot job)
- `ecs/run_task_request_test.go`
- `aws/stepfunctions/*` (where the client to make API calls to stepfunctions is implemented)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
mergify Bot pushed a commit that referenced this pull request May 13, 2021
This PR enables generating a task run command from a Copilot job. Manually tested.

Preceding PR: #2246 


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
…oad (aws#2246)

This PR implement the function to generate a run task request from a deployed job, and the functions to support it.

This PR is rebased from aws#2201 (which is not merged yet). The real changes to this PR are at 
- `ecs/run_task_request.go` (where the information needed to generated a `task run` command is grabbed from a Copilot job)
- `ecs/run_task_request_test.go`
- `aws/stepfunctions/*` (where the client to make API calls to stepfunctions is implemented)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
This PR enables generating a task run command from a Copilot job. Manually tested.

Preceding PR: aws#2246 


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants