Skip to content

feat(ecs): add function to grant run permissions to task definition#20281

Closed
jusdino wants to merge 5 commits intoaws:mainfrom
Mxr-RAPID-DevOps:ecs-grant-run
Closed

feat(ecs): add function to grant run permissions to task definition#20281
jusdino wants to merge 5 commits intoaws:mainfrom
Mxr-RAPID-DevOps:ecs-grant-run

Conversation

@jusdino
Copy link
Copy Markdown
Contributor

@jusdino jusdino commented May 10, 2022

Adding a grantRun(IGrantable) method to aws-ecs.TaskDefinition to make it easier to set up permissions for running task definitions. I'm not super familiar with the case where executionRole is undefined, but I believe leaving that role off the PolicyStatement is the best behavior in that case. Hopefully somebody can sanity check me there. This method is a touch more complicated than I initially planned so it can gracefully handle the case where .addContainer() causes executionRole to be created after a grantRun() was already called (this case is included in the new tests).


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented May 10, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team May 10, 2022 22:42
@github-actions github-actions bot added the p2 label May 10, 2022
@jusdino jusdino changed the title Add TaskDefinition.grantRun() feat(aws-ecs): Add TaskDefinition.grantRun() May 13, 2022
@TheRealAmazonKendra TheRealAmazonKendra changed the base branch from v1-main to main June 2, 2022 18:23
Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. This change requires a README change. Also, please ensure the PR title and body follow our pull request guidelines in our Contributing Guide.

@jusdino jusdino changed the title feat(aws-ecs): Add TaskDefinition.grantRun() feat(aws-ecs): TaskDefinition.grantRun() Jul 14, 2022
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 14, 2022 19:53

Pull request has been modified.

@TheRealAmazonKendra TheRealAmazonKendra changed the title feat(aws-ecs): TaskDefinition.grantRun() feat(ecs): add function to grant run permissions to task definition Jul 15, 2022
Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

@jusdino Looks like the build is failing due to the spacing in the README. Also, please allow us to push to your branch or mergify will not be able to rebase and merge this once it's approved.

@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jul 15, 2022
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 15, 2022 20:32

Pull request has been modified.

@jusdino
Copy link
Copy Markdown
Contributor Author

jusdino commented Jul 15, 2022

Also, please allow us to push to your branch or mergify will not be able to rebase and merge this once it's approved.

So I have not figured out how to allow that when opening a pull request from my org into another. Would you happen to know or have a reference I can go look at?

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 18, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@TheRealAmazonKendra
Copy link
Copy Markdown
Contributor

Also, please allow us to push to your branch or mergify will not be able to rebase and merge this once it's approved.

So I have not figured out how to allow that when opening a pull request from my org into another. Would you happen to know or have a reference I can go look at?

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review July 18, 2022 20:09

Pull request has been modified.

@jusdino
Copy link
Copy Markdown
Contributor Author

jusdino commented Jul 18, 2022

Also, please allow us to push to your branch or mergify will not be able to rebase and merge this once it's approved.

So I have not figured out how to allow that when opening a pull request from my org into another. Would you happen to know or have a reference I can go look at?

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

Well, shoot. That is specifically for user-owned forks, which this is not. I guess, if I can't allow you to push to my branch on an organization-owned fork, I'll have to make sure to fork to my personal user in the future. Does this prevent you from merging this PR? I'm trying to keep updating the branch fairly frequently in the meantime.

Looks like this is the instructions for org owned. https://docs.github.com/en/organizations/managing-organization-settings/managing-the-forking-policy-for-your-organization

We can't merge PRs that can't be edited by us due to the mergify workflow. If this one can't be edited the best course of action is to close it and reopen it under your personal fork.

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: ba28b5f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@jusdino
Copy link
Copy Markdown
Contributor Author

jusdino commented Jul 19, 2022

Yeah, @TheRealAmazonKendra, it looks like I can't let you push back to my branch in the org-owned fork so I did as you suggested and opened a new PR from a personal fork.

mergify bot pushed a commit that referenced this pull request Jul 19, 2022
…21241)

Adding a grantRun(IGrantable) method to aws-ecs.TaskDefinition to make it easier to set up permissions for running task definitions. I'm not super familiar with the case where executionRole is undefined, but I believe leaving that role off the PolicyStatement is the best behavior in that case. Hopefully somebody can sanity check me there. This method is a touch more complicated than I initially planned so it can gracefully handle the case where .addContainer() causes executionRole to be created after a grantRun() was already called (this case is included in the new tests).

Reopening #20281 from a personal fork, since the original org-owned fork doesn't allow PR owners to push to my branch.
@TheRealAmazonKendra 👋 

----

### All Submissions:

* [*] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
comcalvi pushed a commit to comcalvi/aws-cdk that referenced this pull request Jul 25, 2022
…ws#21241)

Adding a grantRun(IGrantable) method to aws-ecs.TaskDefinition to make it easier to set up permissions for running task definitions. I'm not super familiar with the case where executionRole is undefined, but I believe leaving that role off the PolicyStatement is the best behavior in that case. Hopefully somebody can sanity check me there. This method is a touch more complicated than I initially planned so it can gracefully handle the case where .addContainer() causes executionRole to be created after a grantRun() was already called (this case is included in the new tests).

Reopening aws#20281 from a personal fork, since the original org-owned fork doesn't allow PR owners to push to my branch.
@TheRealAmazonKendra 👋 

----

### All Submissions:

* [*] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@jusdino jusdino deleted the ecs-grant-run branch October 12, 2022 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants