I'm trying to have a pipeline that fetches code from Github and deploys it (Lambda, DynamoDB, etc, using CDK). I'm trying to make it work with CodeStarConnectionsSourceAction
at the moment and my code is failing with this error:
[Example4BePipeline/Example4BePipeline/Pipeline] Action Synth in stage Build: first stage may only contain Source actions
[Example4BePipeline/Example4BePipeline/Pipeline] Action 'Synth' is using input Artifact 'Sources', which is not being produced in this pipeline
My code producing that error is:
import * as cdk from "aws-cdk-lib"
import {Construct} from "constructs"
import {Example4BeDeployStage} from "./example4-be-deploy-stage"
import {CodeBuildStep, CodePipeline, CodePipelineFileSet} from "aws-cdk-lib/pipelines"
import {CodeStarConnectionsSourceAction} from "aws-cdk-lib/aws-codepipeline-actions";
import {Artifact} from "aws-cdk-lib/aws-codepipeline";
export class PipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props)
const sourceOutput = new Artifact("Sources");
const sourceAction = new CodeStarConnectionsSourceAction({
actionName: "Github",
owner: "username",
repo: "example4-be",
output: sourceOutput,
connectionArn: "arn:aws:codestar-connections:us-east-1:....:connection/...."
})
const pipeline = new CodePipeline(this, "Example4BePipeline", {
pipelineName: "Example4BePipeline",
synth: new CodeBuildStep("Synth", {
input: CodePipelineFileSet.fromArtifact(sourceOutput),
installCommands: [
"npm install -g aws-cdk"
],
commands: [
"npm ci",
"npm run build",
"npx cdk synth"
]
}
),
selfMutation: false // TODO: remove before committing.
})
}
}
What am I doing wrong here?