Open darylteo opened 3 months ago
Actually in the synth
stage you can define your custom commands before the cdk synth
like
const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
synth: new pipelines.ShellStep('Synth', {
input,
}),
commands: [
// do what ever you want here
'npm run build',
'npx cdk synth',
],
}),
});
Is this something you expect?
That is in fact what I'm doing now but from my understanding this has 2 drawbacks:
cdk deploy
(because the buildspec is baked into the pipeline). Having the finicky build parts after the synth would somewhat mitigate against this. That being said when I mull over this, I realise that there is a chicken and egg problem as the deployment files need to exist to be put into the cdk.out
artifactcdk.out
which then self updates and terminates the current Execution. It then seems to spawn a new execution which requires a build again. The other thing which is kind of annoying is the requirement of the Assets stage - I've already got all the artifacts I need in the same place as the output of the build... why does it need 7 CodeBuildActions to copy the files i already have into separate buckets? 😅 is there any way this could be avoided as it seems to increase build time significantly and also sporadically fails due to too many concurrent codebuild actions.
Perhaps I've been looking at this philosophically from the wrong angle.
Describe the feature
Ability to specify an additional build step after
synth
and afterself-update
and use this as a source for later Stages.Use Case
Pretty frustrating that I can't do this - I am creating a Stack, which I put into a Stage. This works, except that
cdk synth
in my Pipelinesynth
in order for the stack to pull Assets from the artifacts created by those taskscdk deploy
from my machine instead. and then when I push to my repo, it triggers another build again.The intuitive solution if you're new to CDK (like I am) is to add a
Wave
to the Pipeline, before adding the Stage.But the resulting Pipeline adds the "Assets" stage in between the UpdatePipeline stage and the Wave and there's no way to specify the Steps in the Wave as Outputs for the stack deployment Stage.
Proposed Solution
Allow us to specify a CodeBuildStep as a source for later Stacks I guess? 🤷♂️
Other Information
I've tried the following based on other topics along the same lines
pipeline.buildPipeline()
then accessing the underlying pipeline to add an additional CodeBuildAction after the "self-update" actioninput
Acknowledgements
CDK version used
2.133
Environment details (OS name and version, etc.)
os x