I am trying to create a pipeline in another AWS account(AccountB) where is my codecommit repo resides in another AWS Account(AccountA). I did exactly same way from these links:
https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create-cross-account.html https://cloudfornoobs.com/aws-codepipeline-with-cross-account-codecommit-repo/
However after executing the pipeline I the build always get failed. My pipeline.json is as below:
PS:I want to use codecommit and codebuild only I am not using CodeDeploy
> {
> "pipeline": {
> "name": "newpipeline",
> "roleArn": "arn:aws:iam::AccountB:role/AccountBRole",
> "artifactStore": {
> "type": "S3",
> "location": "BucketForArtifactsFromAccountB",
> "encryptionKey": {
> "id": "AccountB_KMS"
> "type": "KMS"
> }
> },
> "stages": [
> {
> "name": "Source",
> "actions": [
> {
> "name": "Source1",
> "actionTypeId": {
> "category": "Source",
> "owner": "AWS",
> "provider": "CodeCommit",
> "version": "1"
> },
> "runOrder": 1,
> "configuration": {
> "BranchName": "dev",
> "PollForSourceChanges": "false",
> "RepositoryName": "backend"
> },
> "outputArtifacts": [
> {
> "name": "Source1"
> }
> ],
> "inputArtifacts": [],
> "roleArn": "arn:aws:iam::AccountA:role/AccountARole"
> }
> ]
> },
> {
> "name": "Build",
> "actions": [
> {
> "name": "Build",
> "actionTypeId": {
> "category": "Build",
> "owner": "AWS",
> "provider": "CodeBuild",
> "version": "1"
> },
> "runOrder": 1,
> "configuration": {
> "EnvironmentVariables": "[{\"name\":\"STAGE_NAME\",\"value\":\"dev\",\"type\":\"PLAINTEXT\"}]",
> "PrimarySource": "Source1",
> "ProjectName": "backend"
> },
>
"outputArtifacts": [
{
"name": "BuildArtifact"
}
],
"runOrder": 1,
"roleArn": "arn:aws:iam::AccountA:role/AccountARole"
}
]
}
],
"artifactStore": {
"type": "S3",
"location": "BucketForArtifactsFromAccountB",
"encryptionKey": {
"id": "AccountB_KMS",
"type": "KMS"
}
},
"version": 19
}
}