My AWS Project builds a Docker Image, pushes it to ECR and then deploys it to an ECS container.
The source code is on CodeCommit, and I already have two working CDK Stacks to 1) Build the Docker image, and 2) Deploy to ECS.
I would like to setup a pipeline via CDK. If I use the console, it is very straightforward to setup the pipeline adding the "Build" and "Deploy" stages defined by the stacks.
If I want to setup the pipeline via CDK, I could use a CDK Python code like this one:
# Create a source action for CodeCommit
source_action = cpactions.CodeCommitSourceAction(
action_name="CodeCommit",
output=codepipeline.Artifact("SourceArtifact")
repository=codecommit.Repository(self, "SourceRepo",
repository_name=SOURCE_GIT_REPOSITORY),
branch=SOURCE_GIT_BRANCH
)
# Create a ShellStep for the synth action (BUT I DO NOT NEED THIS!!!)
synth_action = pipelines.ShellStep("Synth",
input=source_action.output,
commands=[])
# Create a new CodePipeline
pipeline = pipelines.CodePipeline(self, PIPELINE_NAME,
pipeline_name=PIPELINE_NAME,
synth=synth_action, # THIS IS NOT OPTIONAL!
self_mutation=False)
# Add the build stage
pipeline.add_stage(BuildStage(self, "Build"))
# Add the deploy stage
pipeline.add_stage(DeployStage(self, "Deploy", env=kwargs['env']))
the problem is that the 'synth' parameter is required, but I definitely do not need it! What can I do to have my pipeline working without a "synth"? I just need to have source code, and then Build and Deploy stages.
What am I missing?
(BTW, the compiler complains that in the above code 'Build' action already exists, to underline that I did not understand the difference between 'Build' and 'Synth'...)