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

[codepipeline] Insufficient permissions while pulling source from GitHub #8731

Closed
SomayaB opened this issue Jun 25, 2020 · 9 comments · Fixed by #10440
Closed

[codepipeline] Insufficient permissions while pulling source from GitHub #8731

SomayaB opened this issue Jun 25, 2020 · 9 comments · Fixed by #10440
Assignees
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline documentation This is a problem with documentation. guidance Question that needs advice or information.

Comments

@SomayaB
Copy link
Contributor

SomayaB commented Jun 25, 2020

_Originally posted by @jayakumarselvan in aws-samples/aws-cdk-examples#307

I'm trying to make pipeline through AWS CDK with python.

That pipeline simply pulling source from GitHub and deploy to S3 bucket.

When I'm deploy the pipeline (like 'cdk deploy cdkabc'), the pipeline is creting.

But trying to release the pipeline, i'm getting error

Insufficient permissions
Unable to connect to the GitHub repository 'reponame'. Use the console to reconnect your pipeline to GitHub.
The I'm editing the source same pipeline through AWS Console and connect to the GitHub. It is working.

Reference code: https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_codepipeline_actions.README.html#github

Kindly share the solution or links to resolve this.

@SomayaB SomayaB added the needs-triage This issue or PR still needs to be triaged. label Jun 25, 2020
@github-actions github-actions bot added the @aws-cdk/aws-codepipeline Related to AWS CodePipeline label Jun 25, 2020
@SomayaB SomayaB added the guidance Question that needs advice or information. label Jun 25, 2020
@jayakumarselvan
Copy link

jayakumarselvan commented Jun 26, 2020

i got the solution from below code

oauth_token=core.SecretValue.secrets_manager('**secrets_manager_name**', json_field='**secrets_manager_key**'),

@skinny85
Copy link
Contributor

Hey @jayakumarselvan ,

is the Secret you're referencing above for an access token that has read permissions to your GitHub repositories? Like this:

Screen Shot 2020-06-29 at 2 56 47 PM

@skinny85 skinny85 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 29, 2020
@jayakumarselvan
Copy link

Yes I given full access to repo. (Full control of private repositories).

@jayakumarselvan
Copy link

i got the solution from below code

oauth_token=core.SecretValue.secrets_manager('**secrets_manager_name**', json_field='**secrets_manager_key**'),

It is working fine.

@skinny85
Copy link
Contributor

I'm glad. Is there anything else we can help you here @jayakumarselvan ?

@jayakumarselvan
Copy link

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 30, 2020
@skinny85
Copy link
Contributor

@jayakumarselvan do you mean this part?

    oauth_token=cdk.SecretValue.secrets_manager("my-github-token"),

?

@skinny85 skinny85 added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 30, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Jun 30, 2020
@jayakumarselvan
Copy link

Yes. I think

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 5, 2020
@skinny85
Copy link
Contributor

skinny85 commented Jul 6, 2020

Well, this depends on how you store your token in SecretsManger. You can store it as PlainText, and it this case cdk.SecretValue.secrets_manager("my-github-token") works fine. Or, you can store it as a JSON key-value pair, and in that case you need cdk.SecretValue.secrets_manager("my-github-token", json_field="my_key").

Wondering how to make it clear in the docs the difference between the 2 cases.

@SomayaB SomayaB assigned SomayaB and unassigned skinny85 Sep 3, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 10, 2020
@mergify mergify bot closed this as completed in #10440 Sep 21, 2020
mergify bot pushed a commit that referenced this issue Sep 21, 2020
…10440)

There's been some confusion around how to set `GitHubSourceActionProps`'s  `oauthToken` property to a  github token that was stored as a JSON key-value pair in Secrets Manager.

- Updating the [Github Source](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-codepipeline-actions-readme.html#github) section of the docs to clarify how to do so.

Closes #8731

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@SomayaB SomayaB added documentation This is a problem with documentation. and removed in-progress This issue is being actively worked on. labels Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline documentation This is a problem with documentation. guidance Question that needs advice or information.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants