Home > front end >  Build/CodeBuild cannot have more than 5 input artifacts
Build/CodeBuild cannot have more than 5 input artifacts

Time:12-17

I'm trying to deploy an infrastructure stack where I want to use artifacts of 5 additional repo's as input. The reason I have 5 additional repositories is due to the fact that I try to separate business logic from the main infra stack.

My CDK code of our CodePipeline looks like:

deploy_acc.add_action(
    actions.CodeBuildAction(
        input=artifact_infra_code,
        extra_inputs=[
            artifact_extra_1,
            artifact_extra_2,
            artifact_extra_3,
            artifact_extra_4,
            artifact_extra_5,
        ],
        action_name="deploy_data_pipeline",
        project=deploy_data_processing_project,
    )
)

However, when I run cdk synth I get the following error: "Build/CodeBuild cannot have more than 5 input artifacts". Unfortunately, when I look up the documentation, I see only the statement that there can be more than 1 input source. There is no stated upper limit.

Does someone has a good work around/solution to this limitation? Or should I accept that I should merge a couple of repo's or split my main infra code into two separate CodeBuildActions?

CodePudding user response:

These limits can be accessed programmatically via the Action.actionProperties.artifactBounds property.

The limits are described here, and CodeBuild actions do have a limit of 5 input artifacts. To work around this, You can have intermediate CodeBuild actions that merge input artifacts into one. You could use two of them, feed each one a subset of the artifacts, and feed the resulting two to the build action. Or you can just get away with one merging action, and pass the rest of the artifacts directly. I would look into merging some repos, though.

  • Related