我设置了一个AWS CodePipeline,它使用github作为源,使用CodeBuild进行构建,并部署到ElasticBeanstalk。
当控制台中的所有内容都设置好并且我是github帐户的管理员时(我使用了另一个帐户进行测试),我能够使它正常工作
我需要部署的实际代码属于我不是管理员的帐户,因此在this guide之后,我收到了个人访问令牌,并使用CLI更新了CodePipeline。
一旦我使用cli更新了项目,则在提交代码后就不会再触发该项目。
我不确定发生了什么变化,因为即使我使用控制台并直接将webhook设置为我正在测试的github帐户的管理员,它仍然无法正常工作。
这是我使用以下方法更新管道的json:
{
"pipeline": {
"roleArn": "arn:aws:iam::xxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-west-2-xxxxx-xxxx",
"stages": [
{
"name": "Source",
"actions": [
{
"inputArtifacts": [],
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"version": "1",
"provider": "GitHub"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"configuration": {
"Owner": "xxx",
"Repo": "xxx",
"PollForSourceChanges": "false",
"Branch": "stage"
},
"runOrder": 1
}
]
},
{
"name": "Build",
"actions": [
{
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"version": "1",
"provider": "CodeBuild"
},
"outputArtifacts": [
{
"name": "BuildArtifact"
}
],
"configuration": {
"ProjectName": "xxx-stage-codebuild"
},
"runOrder": 1
}
]
},
{
"name": "Deploy",
"actions": [
{
"inputArtifacts": [
{
"name": "BuildArtifact"
}
],
"name": "Deploy",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"version": "1",
"provider": "ElasticBeanstalk"
},
"outputArtifacts": [],
"configuration": {
"ApplicationName": "xxx",
"EnvironmentName": "xxx-stage"
},
"runOrder": 1
}
]
}
],
"artifactStore": {
"type": "S3",
"location": "xxx-artifacts-stage"
},
"name": "xxx-stage",
"version": 15
}
}
答案 0 :(得分:1)
要为更新的GitHub源修复webhook,您需要执行以下步骤:
使用[1]中的步骤注销并删除与旧GitHub存储库关联的现有Webhook。
使用[2]中的步骤重新创建Webhook。
参考:
[1]删除GitHub源的Webhook-https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-delete.html
[2]为GitHub源创建Webhook-https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-create.html
让我知道您是否遇到任何挑战。