I have a standard CDK pipeline and use the output of mvn package to build a docker container. This one is used as DockerImageAsset and gets deployed to different environments. Therefore, the mvn package must run before the cdk synth.
While this works, I don't like the fact that the mvn package runs within the Synth action and I would prefer to have a separate action before, that also publishes test results from unit tests etc.
Is there a way to get an action before Synth ?
This is the current code:
const pipeline = new CodePipeline(this, 'Pipeline', {
dockerEnabledForSynth: true,
dockerEnabledForSelfMutation: true,
crossAccountKeys: true,
synth: new ShellStep('Synth', {
input: CodePipelineSource.gitHub('OWNER/repo', 'main', {
authentication: SecretValue.secretsManager('GITHUB_TOKEN'),
}),
commands: [
'./mvnw package',
'npm ci',
'npm run build',
'npx cdk synth',
]
})
});
...
const dockerImage = new DockerImageAsset(this, 'Image', {
directory: '......'
});
...