Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add multiple CodeCommit source repository to CdkPipline

I am trying to create a CdkPipeline with multiple source CodeCommit repository. I followed instructions from cdkworkshop to successfully create a self-mutating pipeline with single CodeCommit repository but cannot figure out how to add more packages (CodeCommit repository) inside the source stage.

I did see examples from https://docs.aws.amazon.com/cdk/api/latest/docs/aws-codepipeline-actions-readme.html#build--test but this does not provide CDK's self-mutating capability.

This example https://docs.aws.amazon.com/cdk/latest/guide/codepipeline_example.html#codepipeline_example_stack seems a bit more promising but it looks too manual.

Any help would be appreciated.

like image 685
John Seong Avatar asked Oct 17 '25 21:10

John Seong


1 Answers

Late to the response, but here is the solution from the AWS Documentation

If you are using a ShellStep for your initial step, utilize the additional_inputs property:

additional_inputs (Optional[Mapping[str, IFileSetProducer]]) – Additional FileSets to put in other directories. Specifies a mapping from directory name to FileSets. During the script execution, the FileSets will be available in the directories indicated. The directory names may be relative. For example, you can put the main input and an additional input side-by-side with the following configuration:: const script = new pipelines.ShellStep(‘MainScript’, { commands: [‘npm ci’,’npm run build’,’npx cdk synth’], input: pipelines.CodePipelineSource.gitHub(‘org/source1’, ‘main’), additionalInputs: { ‘../siblingdir’: pipelines.CodePipelineSource.gitHub(‘org/source2’, ‘main’), } }); Default: - No additional inputs

In the above example, it shows you how to add an additional GitHub repository as an input, and maps it to the file to ../siblingdir in your ShellStep.

This will work for some types of Steps (Example for CodeBuildStep), but it's recommended to check the documentation to confirm.

like image 141
Jered Avatar answered Oct 28 '25 19:10

Jered



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!