GitHub Authentication for AWS CodePipeline: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:


* [[AWS_CodePipeline_Concepts#GitHub_Authentication|AWS CodePipeline Concepts]]
* [[AWS_CodePipeline_Concepts#GitHub_Authentication|AWS CodePipeline Concepts]]
* [[GitHub_Procedures#GitHub_Authentication_for_AWS_CodePipeline|GitHub Procedures]]
=Overview=
This article describes how to configure the Source stage of an AWS CodePipeline to access a GitHub repository.
=Procedure=
==Create a Personal Access Token==
Use the procedure described here: {{Internal|GitHub_Procedures#Create_a_Personal_Access_Token_for_Command_Line|Create a GitHub Personal Access Token}}
==Update the Pipeline==
===CloudFormation===
Update "OAuthToken" value with the value of the personal access token.
<syntaxhighlight lang='yaml'>
Resources:
  MyPipeline:
    Type: AWS::CodePipeline::Pipeline
    Properties:
      Stages:
        - Name: Source
          Actions:
          - Name: 'pull-from-github'
            ActionTypeId:
              Category: Source
              Owner: ThirdParty
              Version: '1'
              Provider: GitHub
            Configuration:
              Owner: 'novaordis-llc'
              Repo: https://github.com/something
              Branch: master
              OAuthToken: <use the personal access token here>
</syntaxhighlight>
===AWS CLI===
<font color=darkgray>TODO, not tested.</font>
aws codepipeline get-pipeline --name MyPipeline > pipeline.json
Update pipeline.json, as described [[#CloudFormation|above]], then
aws codepipeline update-pipeline --cli-input-json file://pipeline.json
=Troubleshooting=
===="PermissionError: Could not access the GitHub repository====
{{External|https://docs.aws.amazon.com/codepipeline/latest/userguide/troubleshooting.html#troubleshooting-gs2}}

Latest revision as of 23:03, 13 March 2019

External

Internal

Overview

This article describes how to configure the Source stage of an AWS CodePipeline to access a GitHub repository.

Procedure

Create a Personal Access Token

Use the procedure described here:

Create a GitHub Personal Access Token

Update the Pipeline

CloudFormation

Update "OAuthToken" value with the value of the personal access token.

Resources:
  MyPipeline:
    Type: AWS::CodePipeline::Pipeline
    Properties:
      Stages:
        - Name: Source
          Actions:
          - Name: 'pull-from-github'
            ActionTypeId:
              Category: Source
              Owner: ThirdParty
              Version: '1'
              Provider: GitHub
            Configuration:
              Owner: 'novaordis-llc'
              Repo: https://github.com/something
              Branch: master
              OAuthToken: <use the personal access token here>

AWS CLI

TODO, not tested.

aws codepipeline get-pipeline --name MyPipeline > pipeline.json

Update pipeline.json, as described above, then

aws codepipeline update-pipeline --cli-input-json file://pipeline.json

Troubleshooting

"PermissionError: Could not access the GitHub repository

https://docs.aws.amazon.com/codepipeline/latest/userguide/troubleshooting.html#troubleshooting-gs2