HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

CodeBuild - multiple input artifacts in AWS Pipeline

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
artifactsinputcodebuildmultipleawspipeline

Problem

I am building an AWS CodePipeline which depends on two source repositories. If the 'CodeBuild' step is specified with multiple Input artifacts, then you get the error: .. declares 2 input artifacts which is more than the maximum count. Documentation has a strict requirement for CodeBuild to have only a single input artifact.

Lambdas, on another hand, do not have this limitation. I've been looking for a way how a Lambda could "merge" two artifacts into a single one which I can pass to the CodeBuild then. Unfortunately, information on this subject is quite limited.

Does anyone have a working CodePipeline Lambda which would merge two Artifacts into one?

Note: Documentation about How to access artifacts.

Solution

We've had exactly the same problem - our build stage needs to use information from two separate locations.

To solve this in a generic manner, I've created two general purpose Lambdas - one that will merge artifacts, and one that will extract specific files from an artifact. In both cases a new artifact is created that can be passed on to a subsequent CodePipeline stage.

See https://github.com/tooltwist/codepipeline-artifact-munge

If it does not meet your exact requirement, it should be easy enough to tweak to do what you need.

Context

StackExchange DevOps Q#1538, answer score: 6

Revisions (0)

No revisions yet.