Let's imagine that we have one CodePipeline with 2 stages in the following fashion:
new codepipeline.Pipeline(this, name + "Pipeline", {
pipelineName: this.projectName + "-" + name,
crossAccountKeys: false,
stages: [{
stageName: 'Source',
actions: [codeCommitSourceAction]
},{
stageName: 'Build',
actions: [buildAction]
}]
});
Here the Source stage is where we pull the changes from the repository and the Build one is a CodeBuild project which has the following actions in the buildspec file:
- Install the dependencies (
npm i). - Run the tests (
npm run test). - Pack the project (
npm run pack). - Update/deploy lambda function (
aws lambda update-function-code).
In general it does what it supposed to do, however, if the build fails, the only way to find out, which part has failed, is to look to the logs. I would like that it is seen straight from CodePipeline. In this case CodePipeline must have more stages which correlate with each action from CodeBuild. Based on my experience I can do it if for every stage I provide different CodeBuild project.
Question: can I provide same CodeBuild project to the different CodePipeline stages so, that it will execute only part of buildspec file (for example, only running the tests)?