Sarhan
08/02/2024, 2:41 AMMarvin
08/02/2024, 2:41 AMprefect.yaml
, follow these steps:
1. Initialize your deployment configuration:
sh
prefect init
2. Edit the prefect.yaml
file to include the Git commit hash:
Since Prefect automatically initializes with a Git recipe if it detects a repository, you can use Git-related placeholders. However, you might need a custom script to fetch the commit hash dynamically and inject it into the configuration.
3. Example prefect.yaml
configuration:
yaml
version: "{{ GIT_COMMIT_HASH }}"
4. Script to dynamically set the version:
bash
export GIT_COMMIT_HASH=$(git rev-parse HEAD)
prefect deploy --prefect-file=prefect.yaml --version=$GIT_COMMIT_HASH
For more specific details, refer to Prefect's documentation:
- Deployments Overview
- Prefect Deploy Guide