Skip to content
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

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

Merged
merged 6 commits into from
Aug 4, 2020

Conversation

Louise15926
Copy link
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
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.

internal/pkg/cli/task_run.go Outdated Show resolved Hide resolved
internal/pkg/cli/task_run.go Show resolved Hide resolved
templates/environment/cf.yml Outdated Show resolved Hide resolved
internal/pkg/cli/task_run.go Outdated Show resolved Hide resolved
Copy link
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:

@@ -563,16 +563,22 @@ func TestTaskRunOpts_Execute(t *testing.T) {

opts := &runTaskOpts{
runTaskVars: runTaskVars{
GlobalOpts: &GlobalOpts{},
Copy link
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
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 on lines 602 to 604
if opts.env != "" {
opts.deployOpts = []awscloudformation.StackOption{awscloudformation.WithRoleARN("execution role")}
}
Copy link
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
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
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
func (o *runTaskOpts) configureSessAndEnv() error {
var sess *awssession.Session
var env *config.Environment
var err error
Copy link
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.

5 participants