How do you deploy existing deployment artifacts through codepipeline?

151 views Asked by At

Background: I am using github actions for CI and aws codepipeline for CD. Github actions pushes a set of versioned artifacts to S3 and ECR. I setup my AWS codepipeline using CDK.

Question: how do I get the codepipeline to pick up those artifacts and deploy them?

opt 1: Just tag your images and everything else with "latest"

answer: no, having a pipeline that always deploys the latest is not the same as a pipeline that deploys version X.

opt 2: Just send the version number (version X) to codepipeline so that codepipeline knows which artifacts to fetch

answer: no, codepipeline seems to support passing variables between actions (actions generate output variables, other action can pick them up), but I have found no documentation stating that a codepipeline can be triggered with input parameters.

opt 3: tag your commit in github and use a webhook to pass that information along to codepipeline.

answer: no, codepipeline can filter webhooks so that you can trigger the pipeline for certain events, but it does not support parsing the webhook body, picking out stuff you want to use.

opt 4: resolve the version number in cdk synth before that pesky critter tries to update itself.

answer: yeah, that kinda works, I can query an ecr repo, find that actual version number of the release and regenerate the pipeline so that it points to the resolved version. Its not the same as passing a version number from github to codepipeline, but at least my pipeline is versioned and all my deployment units (like ECS services, batch jobs, etc) are pointing to an explicit version after deployment. Unfortunately, this has several drawbacks, like making the deployment pipeline (even) slow(er) and if the pipeline fails I will have update the pipeline by running cdk deploy from my machine.

opt 5: you come in to save the day :-)

0

There are 0 answers