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

[aws-codecommit] cloneUrls returned from Repository.fromRepositoryArn(...) do not respect region in ARN #10630

Closed
raykrueger opened this issue Oct 1, 2020 · 4 comments · Fixed by #10639
Assignees
Labels
@aws-cdk/aws-codecommit Related to AWS CodeCommit bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@raykrueger
Copy link
Contributor

raykrueger commented Oct 1, 2020

An IRepository instance created using Repository.fromRepositoryArn does not respect the region in the Arn. This results in a cloneUrl for the current stack region, not the region intended in the arn.

Reproduction Steps

const repo = Repository.fromRepositoryArn(stack, 'Repo', 'arn:aws:codecommit:us-east-1:1234567890:TestRepo');
console.log(repo.repositoryCloneUrlHttp);

What did you expect to happen?

While running my stack against us-west-2, I expect the clone url to come back with the region specified in the arn; us-east-1.

What actually happened?

Calls to repositoryCloneUrlHttp return a clone url targeting us-west-2, my stack region, not us-east-1 as specified in the arn.

Environment

  • CLI Version : 1.65
  • Framework Version: 1.65
  • Node.js Version: 12.14.1
  • OS : Macos
  • Language (Version): ts 3.9.7

Other

As seen here, makeCloneUrl uses ${stack.region}

return `${protocol}://git-codecommit.${stack.region}.${stack.urlSuffix}/v1/repos/${repositoryName}`;


This is 🐛 Bug Report

@raykrueger raykrueger added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 1, 2020
@github-actions github-actions bot added the @aws-cdk/aws-codecommit Related to AWS CodeCommit label Oct 1, 2020
@raykrueger
Copy link
Contributor Author

Made a few edits to clarify the region mismatch where I said us-east-2 but meant us-east-1. Also corrected the "Other" url to point to the correct location, I was linking to an old version I was looking at for regressions.

@skinny85
Copy link
Contributor

skinny85 commented Oct 1, 2020

Thanks for reporting @raykrueger . This seems like a simple fix - I think you've already identified where the problem is. Any chance you could submit us a PR with a fix for this? Our docs talk about getting started with contributing to the CDK: https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md

Thanks,
Adam

@skinny85 skinny85 added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 1, 2020
@raykrueger
Copy link
Contributor Author

raykrueger commented Oct 1, 2020

Yep, happy to work on a fix. I'm building a workaround in my app that I need first :)

@raykrueger
Copy link
Contributor Author

PR incoming shortly

raykrueger added a commit to raykrueger/aws-cdk that referenced this issue Oct 1, 2020
As a CDK User I expect Repository.fromRepositoryArn to use the region
given when building the repository clone urls.

Prior to this commit, a stack deploy in us-east-1, would return clone
urls for us-east-1 even if given an ARN for us-west-2.
raykrueger added a commit to raykrueger/aws-cdk that referenced this issue Oct 1, 2020
As a CDK User I expect Repository.fromRepositoryArn to use the region
given when building the repository clone urls.

Prior to this commit, a stack deploy in us-east-1, would return clone
urls for us-east-1 even if given an ARN for us-west-2.

Fixes aws#10630
@mergify mergify bot closed this as completed in #10639 Oct 1, 2020
mergify bot pushed a commit that referenced this issue Oct 1, 2020
…clone urls (#10639)

As a CDK User I expect Repository.fromRepositoryArn to use the region
given when building the repository clone urls.

Prior to this commit, a stack deploy in us-east-1, would return clone
urls for us-east-1 even if given an ARN for us-west-2.

Fixes #10630

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codecommit Related to AWS CodeCommit bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants