【问题标题】:AWS CodePipeline Add Github Source from CloudFormation TemplateAWS CodePipeline 从 CloudFormation 模板添加 Github 源
【发布时间】:2023-03-19 18:05:02
【问题描述】:

我正在使用本教程中的 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

GitHub 是如何定义为资源的,以及如何处理私有存储库的身份验证?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-codepipeline


    【解决方案1】:

    例如,对于 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 个人令牌并将其插入到您的代码管道中

    github personal token intergration into code pipeline

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-04
      • 1970-01-01
      • 2022-01-19
      • 2019-07-05
      • 1970-01-01
      • 2019-07-28
      • 2017-05-26
      • 2018-09-06
      相关资源
      最近更新 更多