Skip to content

chore: update task run to use manager roles and update manager permissions#1212

Merged
mergify[bot] merged 6 commits intoaws:masterfrom
Louise15926:task-run/update-envmng-perm
Aug 4, 2020
Merged

chore: update task run to use manager roles and update manager permissions#1212
mergify[bot] merged 6 commits intoaws:masterfrom
Louise15926:task-run/update-envmng-perm

Conversation

@Louise15926
Copy link
Copy Markdown
Contributor

This PR contains the following changes:

  1. Update environment manager role's permission in support of task run
  2. Update task run to use environment manager

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

@Louise15926 Louise15926 requested a review from a team as a code owner July 30, 2020 23:40
@Louise15926 Louise15926 added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 3, 2020
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.

Looks good to me. Just a small nit.

Comment thread internal/pkg/cli/task_run.go Outdated
Comment thread internal/pkg/cli/task_run.go
Comment thread templates/environment/cf.yml Outdated
Comment thread internal/pkg/cli/task_run.go Outdated
Copy link
Copy Markdown
Contributor

@iamhopaul123 iamhopaul123 left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me! Just one tiny nit :shipit:


opts := &runTaskOpts{
runTaskVars: runTaskVars{
GlobalOpts: &GlobalOpts{},
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 remove this?

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.

no because we need it to call AppName() in deploy() 😢

Comment thread internal/pkg/cli/task_run_test.go Outdated
Comment on lines +602 to +604
if opts.env != "" {
opts.deployOpts = []awscloudformation.StackOption{awscloudformation.WithRoleARN("execution role")}
}
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.

Mmm we shouldn't have custom logic in our tests otherwise we are not testing the real code-path.
I wonder if instead we should store the targetEnv as a field and have that lookup in the deploy() method so that we test if the real code checks if an env is not nil and passes the appropriate execution role arn.

I really like the two test-cases written above :)

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.

If targetEnv is being set in configureRuntimeOpts, it seems like we will still not able to set it without writing custom logic in the tests, right?

It seems to me that in order to make the testing work, I will have to somehow isolate the targetEnv-related logic from configureRuntimeOpts.

This is reflected in the latest code change. I'm not sure if I like this approach - please let me know what you think👀

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.

jes totally makes sense, thank you!

@Louise15926 Louise15926 requested a review from efekarakus August 3, 2020 23:52
Comment thread internal/pkg/cli/task_run.go Outdated
func (o *runTaskOpts) configureSessAndEnv() error {
var sess *awssession.Session
var env *config.Environment
var err 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.

nit: not needded

@Louise15926 Louise15926 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 4, 2020
@Louise15926 Louise15926 force-pushed the task-run/update-envmng-perm branch from f1e629d to 7e5ca73 Compare August 4, 2020 14:52
@mergify mergify bot merged commit fc1f917 into aws:master Aug 4, 2020
@Louise15926 Louise15926 deleted the task-run/update-envmng-perm branch August 5, 2020 16:57
mergify bot pushed a commit that referenced this pull request Aug 5, 2020
This PR contains the following changes:
1. implement `--follow` flag for `task run`
2. implement `EarliestStartTime` method in `task` package in support of `--follow`
3. wrap `aws-sdk-go/ecs` constant `DesiredStatusStopped` in `ecs` package in support of `--follow`

Should be merged only after #1212 
Related #702 

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.

6 participants