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

fix(ecr): policytext errors when includes resource #24401

Merged
merged 10 commits into from
Apr 4, 2023

Conversation

ahammond
Copy link
Contributor

@ahammond ahammond commented Mar 1, 2023

ECR does not allow resource to be included in private repository resource policies.
CFN largely swallows the error message.
Most resources require or at least allow a resource in their policies, so we should at least warn.

See issue #24314

@github-actions github-actions bot added the p2 label Mar 1, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team March 1, 2023 17:23
@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label Mar 1, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@ahammond ahammond force-pushed the warn-for-resource-in-ecr-policy branch 2 times, most recently from 4970dbe to 55450ae Compare March 1, 2023 17:40
@ahammond ahammond changed the title fix(aws-ecr): warn when unsupported resource is present fix(ecr): warn when unsupported resource is present Mar 1, 2023
@ahammond ahammond force-pushed the warn-for-resource-in-ecr-policy branch from 55450ae to 3889fe5 Compare March 1, 2023 17:44
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 1, 2023 17:47

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

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

Thanks for picking this up!

Looks like hasWarnings should be hasWarning, which is causing the build failure. Also just a note that on a fix the PR title should state the bug, not the solution implemented. Can you adjust that, please?

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review March 1, 2023 19:59

Pull request has been modified.

@ahammond ahammond changed the title fix(ecr): warn when unsupported resource is present fix(ecr): policytext errors when includes resource Mar 1, 2023
@ahammond
Copy link
Contributor Author

ahammond commented Mar 1, 2023

I tried to test this locally, but

❯ ../../../scripts/buildup         
************************************************************
 buildup usage:
 - execute 'buildup --resume' to resume after failure
 - execute 'buildup' to restart the build from the start

 for advanced usage, see /Users/ahammond/Documents/aws/aws-cdk/scripts/foreach.sh
************************************************************
state cleared. you are free to start a new command.
starting new session ('@aws-cdk/aws-ecr' and its dependencies)
---------------------------------------------------------------------------------
/Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/eslint-plugin: yarn build  (23 remaining)
---------------------------------------------------------------------------------
/Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/node-bundle: yarn build  (22 remaining)
---------------------------------------------------------------------------------
/Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/pkglint: yarn build  (21 remaining)
yarn run v1.22.19
$ tsc -b && eslint . --ext=.ts && chmod +x bin/pkglint

/Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/pkglint/lib/rules.ts
  20:25  error  `../package.json` import should occur before import of `./aws-service-official-names.json`  import/order

/Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/pkglint/test/rules.test.ts
  3:1  error  `./fake-module` import should occur after import of `../lib/rules`  import/order

✖ 2 problems (2 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error: last command failed. fix problem and resume by executing: /Users/ahammond/Documents/aws/aws-cdk/scripts/foreach.sh
directory:    /Users/ahammond/Documents/aws/aws-cdk/tools/@aws-cdk/pkglint

@TheRealAmazonKendra
Copy link
Contributor

Oh, we just added some linting checks are you're running up against, probably because your branch is from before we did that. It's annoying so gimme an hour or two and I'll resolve the issues on this PR.

@TheRealAmazonKendra TheRealAmazonKendra added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Mar 1, 2023
@TheRealAmazonKendra
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 1, 2023

update

✅ Branch has been successfully updated

@ahammond
Copy link
Contributor Author

ahammond commented Mar 6, 2023

@TheRealAmazonKendra I see that the codebuild failed, however when I try to click through to see the issue I end up at an AWS login. I don't imagine I have the necessary credentials. :) Anyway, I've tried and failed to run the build and test locally and can't see the output of the failed build. I'm feeling a little bit blocked here.

@ahammond
Copy link
Contributor Author

ahammond commented Mar 6, 2023

Ah, I see the build logs link above. I'll chase that down.

@ahammond
Copy link
Contributor Author

ahammond commented Mar 6, 2023

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Mar 6, 2023

update

☑️ Nothing to do

  • #commits-behind>0 [:pushpin: update requirement]
  • -closed [:pushpin: update requirement]

ahammond and others added 4 commits March 6, 2023 07:49
ECR does not allow resource to be included in private repository resource policies.
CFN largely swallows the error message.
Most resources require or at least allow a resource in their policies, so we should at least warn.

See issue aws#24314
@ahammond ahammond force-pushed the warn-for-resource-in-ecr-policy branch from f8d2d27 to a71d1cc Compare March 6, 2023 15:49
@ahammond
Copy link
Contributor Author

ahammond commented Mar 7, 2023

@Mergifyio update

Naumel
Naumel previously requested changes Mar 8, 2023
packages/@aws-cdk/aws-ecr/README.md Outdated Show resolved Hide resolved
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@ahammond
Copy link
Contributor Author

ahammond commented Mar 22, 2023 via email

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

6 similar comments
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@mergify mergify bot dismissed Naumel’s stale review March 30, 2023 21:30

Pull request has been modified.

@ahammond
Copy link
Contributor Author

@TheRealAmazonKendra PR updated.

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@ahammond ahammond force-pushed the warn-for-resource-in-ecr-policy branch from a32ca7c to 4d26f49 Compare April 4, 2023 15:43
@ahammond
Copy link
Contributor Author

ahammond commented Apr 4, 2023

@TheRealAmazonKendra updated again. Please merge.

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

Looks good!

@mergify
Copy link
Contributor

mergify bot commented Apr 4, 2023

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit a9d6966 into aws:main Apr 4, 2023
@mergify
Copy link
Contributor

mergify bot commented Apr 4, 2023

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).

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 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants