代码之家  ›  专栏  ›  技术社区  ›  Ken J

AWS代码管道从CloudFormation模板添加Github源

  •  1
  • Ken J  · 技术社区  · 7 年前

    我正在使用本教程中的Cloudformation堆栈:

    https://aws.amazon.com/blogs/compute/continuous-deployment-for-serverless-applications/

    它创建一个以CodeCommit存储库作为源的管道。我想将此切换到Github存储库。以下是定义此资源的代码:

     Pipeline:
            Type: AWS::CodePipeline::Pipeline
            Properties:
                ArtifactStore: 
                    Location: !Ref BuildArtifactsBucket
                    Type: S3
                Name: !Sub ${ServiceName}_pipeline
                RoleArn: !GetAtt PipelineExecutionRole.Arn
                Stages:
                    - Name: Source
                      Actions:
                        - Name: CodeCommitRepo
                          ActionTypeId:
                            Category: Source
                            Owner: AWS
                            Provider: CodeCommit
                            Version: 1
                          Configuration:
                            RepositoryName: !Sub '${ServiceName}_repo'
                            BranchName: master
                          OutputArtifacts:
                            - Name: SourceZip
                          RunOrder: 1
    

    1 回复  |  直到 7 年前
        1
  •  2
  •   varnit    7 年前

    例如,对于github,您需要用github替换提供程序

     Pipeline:
            Type: AWS::CodePipeline::Pipeline
            Properties:
                ArtifactStore: 
                    Location: !Ref BuildArtifactsBucket
                    Type: S3
                Name: !Sub ${ServiceName}_pipeline
                RoleArn: !GetAtt PipelineExecutionRole.Arn
                Stages:
                    - Name: Source
                      Actions:
                        - Name: GithubRepo
                          ActionTypeId:
                            Category: Source
                            Owner: ThirdParty
                            Provider: GitHub
                            Version: 1
                          Configuration:
                            "Owner": "MyGitHubAccountName",
                            "Repo": "MyGitHubRepositoryName",
                            "PollForSourceChanges": "false",
                            "Branch": "master",
                            "OAuthToken": "****"
    
                          OutputArtifacts:
                            - Name: SourceZip
                          RunOrder: 1
    

    有关更多信息,请单击

    code pipeline thirdparty source provider

    github personal token intergration into code pipeline