Caio Henrique
07/23/2025, 8:25 PMMarvin
07/23/2025, 8:25 PMMarvin
07/23/2025, 8:26 PMfrom_source()
method.
Here's how you can do it:
1. Using Python:
python
from prefect import flow
@flow
def my_flow():
# your flow code here
pass
# Deploy the flow from your Gitea repository
flow.from_source(
"<https://your-gitea-instance.com/owner/repository>",
# Optional: specify branch/tag
reference="main"
).deploy(
name="my-deployment",
work_pool_name="your-work-pool"
)
2. Or using the CLI with a prefect.yaml
file that specifies your Gitea repository:
yaml
# prefect.yaml
deployments:
- name: my-deployment
version: null
tags: []
description: null
schedule: null
flow_name: my_flow
entrypoint: path/to/flow.py:my_flow
parameters: {}
work_pool:
name: your-work-pool
source:
repository: <https://your-gitea-instance.com/owner/repository>
branch: main
Then deploy using:
bash
prefect deploy
A few important notes:
1. If your Gitea repository requires authentication, you'll need to ensure:
- Your git credentials are properly configured on the machine running the worker
- Or use an access token in the URL: <https://username:token@your-gitea-instance.com/owner/repository>
2. The worker executing the deployment needs to have access to your Gitea instance.
3. For private repositories, make sure your git credentials are properly configured on the worker machine.
This approach should work with any git-based service, including Gitea, as it uses standard git protocols under the hood. If you run into any specific issues with authentication or access, let me know and I can provide more detailed guidance.Nate
07/23/2025, 8:29 PMgit clone
with the CLI you could use
but in the yaml there you'd use pull
steps, there is no source
key like that (tho that's not a bad DX!)Marvin
07/23/2025, 8:29 PMMarvin
07/23/2025, 8:29 PMpull
steps to handle git operations. Here's the correct structure:
yaml
# prefect.yaml
deployments:
- name: my-deployment
version: null
tags: []
description: null
schedule: null
flow_name: my_flow
entrypoint: path/to/flow.py:my_flow
parameters: {}
work_pool:
name: your-work-pool
pull:
- prefect.deployments.steps.git_clone:
repository: <https://your-gitea-instance.com/owner/repository>
branch: main
You're also absolutely right about the general principle - if you can git clone
it, you can use it as a source for your deployment. This makes it quite flexible as it works with any git provider (Gitea, GitHub, GitLab, Bitbucket, or even self-hosted git servers) as long as:
1. The URL is accessible
2. You have the proper authentication set up (if needed)
3. The worker can perform the git operations
Thank you for the correction! It's important to be precise with these configurations.