CodePipeline Output artifact format – Full clone


Something that I learned Today – I was working a CodePipeline pipeline which gets the source codes from a CodeStar connection that was built to a Bitbucket Cloud workspace. And in the following stage, I needed to get the git commit history of that repository.

As shown below CodePipeline does not keep the git metadata about the repository by default. To achieve what is required, I need to use the “Full clone” as the output artifact format.

In CDK, the setting is named as codeBuildCloneOutput. Here is a example:

const pipeline = new cdk.aws_codepipeline.Pipeline(this, "Pipeline", {
role: pipelineRole,
restartExecutionOnUpdate: true,
enableKeyRotation: true,
});
pipeline.addStage({
stageName: "Get_Source",
actions: [
new cdk.aws_codepipeline_actions.CodeStarConnectionsSourceAction({
actionName: "Bitbucket_Source",
connectionArn: this.bitbucketCodestarConnection.valueAsString,
owner: this.bitbucketRepositoryOwner.valueAsString,
repo: this.bitbucketRepository.valueAsString,
branch: this.bitbucketBranch.valueAsString,
output: pipelineArtifact,
codeBuildCloneOutput: true,
}),
],
});

Leave a comment