I am trying to use code pipeline and code build to create a cdk deployment where my github repo consists of several projects defined in a single github repo.
My Project Structure
Github:
/microservice1
/microservice2
Banging my head against this one for some time and reaching out to see if anyone else has experience this:
My CDK Code is like this:
const pipeline = new CodePipeline(this, `${id}-code-pipline`, {
pipelineName: `${id}-code-pipline`,
role,
synth: new ShellStep(`${id}-code-pipeline-synth`, {
input: CodePipelineSource.gitHub('joeMama123/stupid', 'master', {
authentication: SecretValue.secretsManager('stackoverflow', {
jsonField: "WHY_AWS_DO_THIS_TO_ME_ON_EVERY_NEW_SERVICE_I_USE"
}),
}),
env: {
stage: "dev",
},
commands: [
'cd microservice1 && npm ci && npx cdk synth',
'cd microservice2 && npm ci && npx cdk synth',
],
primaryOutputDirectory: '', //have more than on location here.
}),
});
The issue seems that the shell does not preserve the directory structure for subsequent commands. Its almost like the directory vanishes after the first command executes the command.
How can I preserve the initial github checkout structure so that I can navigate between the microservices, perform individual builds and synths and the deploy them from a single pipeline.
Any help would be greatly appreciated!!