<@ULVA73B9P> how do I set my deployment version as...
# ask-marvin
s
@Marvin how do I set my deployment version as my git commit hash in my prefect.yaml?
m
To set your deployment version as your Git commit hash within
prefect.yaml
, follow these steps: 1. Initialize your deployment configuration:
Copy code
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:
Copy code
yaml
   version: "{{ GIT_COMMIT_HASH }}"
4. Script to dynamically set the version:
Copy code
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