https://prefect.io logo
d

Daniel Saxton

05/21/2022, 4:04 PM
any suggestions / best practices for triggering Prefect jobs within a CI/CD pipeline? suppose we're building a Docker image within the pipeline and pushing it to a container registry, and want to execute a flow using that container image, guaranteeing that we're always using the latest (can we do this with a Docker agent?)
e

emre

05/21/2022, 4:22 PM
Once you register a version of a flow, that flow versions
docker tag
is fixed and cannot be changed. To have your flow use a recently built docker image, you have two options: 1. Re-register your flow with the
docker tag
of your newly built image 2. Maintain a
docker tag
like
latest
, that always points to the most recently built image, and register your prefect flow with the tag
latest
. This way you ensure that the docker agent looks for the most recent image version, without modifying your flow versions at all. I never needed such a use case, but I would prefer option 2. That way docker image versions and flow versions stay decoupled.
upvote 1
d

Daniel Saxton

05/21/2022, 4:33 PM
thanks, and the Docker image would be set in the
run_config
of the flow: https://docs.prefect.io/orchestration/flow_config/run_configs.html#dockerrun, right?
a

Anna Geller

05/21/2022, 4:38 PM
yup exactly, you can set custom image and tag using DockerRun or KubernetesRun, depending on which agent you use
👍 1