aws / git-remote-codecommit

An implementation of Git Remote Helper that makes it easier to interact with AWS CodeCommit
Apache License 2.0
271 stars 38 forks source link

Support China regions #10

Closed zxkane closed 3 years ago

zxkane commented 4 years ago

AWS CodeCommit is GA in AWS China now. Pls support china regions(cn-north-1 and cn-northwest-1).

See below error when pushing code to AWS CodeCommit in cn-northwest-1.

git remote add codecommit codecommit::cn-northwest-1://CodecommitDevopsModelStack-MyApp1

git push codecommit master:init
The following AWS Region is not available for use with AWS CodeCommit: cn-northwest-1. For more information about CodeCommit's availability in AWS Regions, see the AWS CodeCommit User Guide. If an AWS Region is listed as supported but you receive this error, try updating your version of the AWS CLI or the AWS SDKs.

AWS cli already is latest version,

aws --version
aws-cli/2.0.9 Python/3.8.2 Darwin/18.7.0 botocore/2.0.0dev13
zxkane commented 4 years ago

It should be caused by boto/botocore#2026.

zxkane commented 4 years ago

How about making the checking of available region as a warning? Currently the CodeBuild is blocked by this to pull source from CodeCommit. Looks like it has a lag(several days) to sync the new services availability to the botocore's static config.

Looks like it will always occur when CodeCommit is expanded to new regions.

liangruibupt commented 4 years ago

Here is workaround:

edit the file 
<YOUR_CURRENT_PYTHON_DIR>/site-packages/git_remote_codecommit/__init__.py

locate the line:
     available_regions = [region for partition in session.get_available_partitions() for region in session.get_available_regions('codecommit', partition)]
(Added in >>>) available_regions.append("cn-north-1")
(Added in >>>) available_regions.append("cn-northwest-1")
git clone codecommit::cn-northwest-1://cn-north-1@MyDemoRepo
Cloning into 'MyDemoRepo'...
remote: Counting objects: 20, done.
Unpacking objects: 100% (20/20), done.
tuxinaut commented 3 years ago

We setup the helper last Friday in cn-north-1 and it worked out of the box, so it should work as well flawlessly for cn-northwest-1 .

zxkane commented 3 years ago

It had been resolved by latest botocore.

tuxinaut commented 3 years ago

:+1: