Anthony W
02/17/2025, 10:30 PM# Welcome to your prefect.yaml file! You can use this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.git_clone:
repository: <https://gitlab.company.com/business-intelligence/repo.git>
branch: dev
credentials: '{{ prefect.blocks.gitlab-credentials.repo }}'
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: surveys_ingestion_staging
version:
tags: []
description:
entrypoint: flows/surveys/surveys_ingestion.py:surveys_ingestion
parameters: {}
work_pool:
name: ecs-staging-m
work_queue_name:
job_variables: {}
schedules: []
concurrency_limit:
- name: conversations_ingestion_staging
version:
tags: []
description:
entrypoint: flows/conversations/conversations_ingestion.py:conversations_ingestion
parameters: {}
work_pool:
name: ecs-staging-m
work_queue_name:
job_variables: {}
schedules: []
concurrency_limit:
I have my CICD pipeline running prefect --no-prompt deploy --all
, however, I would like to have a prod section in addition to the staging section for pulling. For example, in my deploy-staging section of my CICD pipeline, I would run something like prefect --no-prompt deploy --staging-section-only
and prefect --no-prompt deploy --prod-section-only
Marvin
02/17/2025, 10:30 PMprefect.yaml
for CI/CD, you can define separate deployment configurations for each environment (e.g., staging and production). Each deployment can have its own pull
section, allowing you to specify different branches or repositories. Here's how you can structure your `prefect.yaml`:
1. Separate Pull Sections: You can define separate pull sections within each deployment definition to handle different branches or environments.
2. Use Deployment Overrides: Prefect allows you to override pull
sections for each deployment. This means you can specify different pull instructions for each deployment.
Here's an example structure:
yaml
# Main pull section (optional)
pull:
- prefect.deployments.steps.git_clone:
repository: <https://gitlab.company.com/business-intelligence/repo.git>
branch: dev
credentials: '{{ prefect.blocks.gitlab-credentials.repo }}'
# Deployment configurations
deployments:
- name: surveys_ingestion_staging
pull:
- prefect.deployments.steps.git_clone:
repository: <https://gitlab.company.com/business-intelligence/repo.git>
branch: staging
credentials: '{{ prefect.blocks.gitlab-credentials.repo }}'
entrypoint: flows/surveys/surveys_ingestion.py:surveys_ingestion
work_pool:
name: ecs-staging-m
- name: surveys_ingestion_prod
pull:
- prefect.deployments.steps.git_clone:
repository: <https://gitlab.company.com/business-intelligence/repo.git>
branch: prod
credentials: '{{ prefect.blocks.gitlab-credentials.repo }}'
entrypoint: flows/surveys/surveys_ingestion.py:surveys_ingestion
work_pool:
name: ecs-prod-m
To deploy a specific configuration, use the --name
flag with the prefect deploy
command to specify which deployment to run:
- For staging: prefect --no-prompt deploy --name surveys_ingestion_staging
- For production: prefect --no-prompt deploy --name surveys_ingestion_prod
This setup allows you to manage different environments within the same prefect.yaml
file, using deployment-specific configurations. You can find more about deployment mechanics in the Prefect documentation.