AWSCDKPipeline没有在将代码推送到Bitbucket时触发
创始人
2024-09-24 02:30:46
0
  1. 确保您的AWS CDK Pipeline已与Bitbucket集成,并且已经设置了正确的触发器。
  2. 您需要检查您的Bitbucket仓库是否配置了正确的Webhook,以触发管道。 以下是一个示例Bitbucket仓库配置的Python代码:
from aws_cdk import (
    core, 
    aws_codepipeline as codepipeline, 
    aws_codepipeline_actions as actions, 
    aws_codecommit as codecommit
)

class MyStack(core.Stack):

  def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
    super().__init__(scope, id, **kwargs)

    # Your Bitbucket repository credentials
    bitbucket_conn = codecommit.CfnRepository.ConnectionArnProperty(
        arn="YOUR_BITBUCKET_CONNECTION_ARN_HERE"
    )

    # Creating an S3 Bucket
    bucket = s3.Bucket(
        self, "MyPipelineBucket",
        bucket_name="my-pipeline-bucket"
    )

    # Creating a CodeCommit Repository
    repository = codecommit.Repository(
        self, "MyRepository",
        repository_name="my-repository-name",
        connection_arn=bitbucket_conn
    )

    # Creating a CodePipeline Artifact Bucket
    artifact_bucket = s3.Bucket(
        self, "MyArtifactBucket",
        bucket_name="my-artifact-bucket"
    )

    #Creating an AWS CodePipeline using the CodeCommit Repository as input
    pipeline = codepipeline.Pipeline(
        self, "MyPipeline",
        pipeline_name="my-pipeline-name",
        artifact_bucket=artifact_bucket
    )

    #Creating a CodeCommit Source Action to retrieve the source code
    source_action = actions.CodeCommitSourceAction(
        action_name="CodeCommit",
        repository=repository,
        output=codepipeline.Artifact("SourceArtifact")
    )

    #Creating a build Action to compile and upload the Spark Jar to S3
    build_action = actions.CodeBuildAction(
        action_name="MyBuild",
        input=codepipeline.Artifact("SourceArtifact"),
        outputs=[codepipeline.Artifact("MyArtifact")],
        project=MyBuildProject

相关内容

热门资讯

程序员教你!微乐自建房辅助工具... 程序员教你!微乐自建房辅助工具脚本,微乐小程序免费黑科技(开挂自建房)方法1、微乐自建房辅助工具脚本...
技术分享!微乐自建房辅助工具脚... 技术分享!微乐自建房辅助工具脚本,微乐家乡麻将自建房辅助app(开挂自建房)器1、下载好微乐家乡麻将...
重大来袭!微乐小程序麻将自建房... 重大来袭!微乐小程序麻将自建房辅助工具插件,微乐家乡麻将自建房辅助app(开挂自建房)脚本运微乐小程...
玩家必看科普!微乐自建房辅助工... 玩家必看科普!微乐自建房辅助工具挂,微乐家乡麻将自建房辅助app(开挂自建房)技巧1)微乐家乡麻将自...
必看攻略!微乐家乡麻将自建房辅... 必看攻略!微乐家乡麻将自建房辅助app,微乐家乡麻将自建房辅助app(开挂自建房)脚本小薇(辅助器软...
科技新动态!微乐小程序麻将自建... 科技新动态!微乐小程序麻将自建房辅助工具插件,微乐自建房脚本免费入口(开挂自建房)方法1)微乐小程序...
玩家必看分享!微乐自建房辅助工... 玩家必看分享!微乐自建房辅助工具,微乐自建房脚本免费入口(开挂自建房)技巧亲,关键说明,微乐自建房辅...
重大推荐!微乐家乡麻将自建房辅... 重大推荐!微乐家乡麻将自建房辅助app,微乐小程序免费黑科技(开挂自建房)app1、点击下载安装,微...
科普攻略!微乐家乡麻将自建房辅... 科普攻略!微乐家乡麻将自建房辅助app,微乐家乡麻将自建房辅助app(开挂自建房)脚本1、不需要AI...
揭秘几款!微乐微信自建房辅助工... 揭秘几款!微乐微信自建房辅助工具插件,微乐小程序免费黑科技(开挂自建房)app1、进入游戏-大厅左侧...