Reputation: 619
I set up an AWS CodePipeline that uses github as a source, CodeBuild for build, and deploys to ElasticBeanstalk.
I was able to get it working when everything was set up in the console and I was an admin of the github account (I used a different account for testing)
The actual code I need to deploy belongs to an account where I am not an admin so following this guide I received a Personal Access Token and updated the CodePipeline using the CLI.
Once i updated the project using the cli, it no longer gets triggered when the code is committed.
I'm not sure what changed, because it still doesn't work even when I use the console and set up the webhook directly as an admin of the github account I was testing with.
This is the json I updated the pipeline with:
{
"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
}
}
Upvotes: 2
Views: 6478
Reputation: 8890
To fix the webhook for the updated GitHub source, you need to perform the following steps:
Use the steps in [1] to deregister and delete the existing webhook that is associated with the old GitHub repository.
Use the steps in [2] to recreate the webhook.
Ref:
[1] Delete the Webhook for Your GitHub Source - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-delete.html
[2] Create a Webhook for a GitHub Source - https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-webhooks-create.html
Let me know if you come across any challenges.
Upvotes: 3