<@ULVA73B9P> I see this as a way to create a prefe...
# marvin-in-the-wild
m
@Marvin I see this as a way to create a prefect deployment in your docs:
Copy code
from prefect import flow

if __name__ == "__main__":
    flow.from_source(
        source="<https://github.com/prefecthq/demos.git>",
        entrypoint="my_gh_workflow.py:repo_info",
    ).deploy(
        name="my-first-deployment",
        work_pool_name="my-managed-pool",
        cron="0 1 * * *",
    )
But what if it's not in main branch but in a feature branch, how to specify it?
m
There's no specific reference in the docs about how to specify a branch directly using
flow.from_source()
. However, based on a GitHub issue addressing a similar requirement, it's possible to set the branch by providing options within the deployment configuration. Here’s an approach using YAML configuration that includes specifying a branch when deploying from a source: 1. Create a
prefect.yaml
file
for your deployment:
Copy code
yaml
# prefect.yaml
name: my-first-deployment
prefect-version: 2.0
build: null
push: null
pull:
  - prefect.deployments.steps.set_working_directory:
      directory: /mnt

  - prefect.deployments.steps.git_clone:
      repository: <https://github.com/prefecthq/demos.git>
      branch: feature-branch-name

  - prefect.deployments.steps.set_working_directory:
      directory: /mnt/demos
# Update accordingly to your repo structure
deployments:
  - name: my-first-deployment
    version: null
    entrypoint: my_gh_workflow.py:repo_info
    work_pool:
      name: my-managed-pool
      work_queue_name: null
      job_variables: {}
    schedule:
      cron: "0 1 * * *"
2. Run your deployment with the configured YAML:
Copy code
bash
prefect deploy --name my-first-deployment
Note: - Make sure to replace
feature-branch-name
with the actual branch name you want to deploy from. - Adjust directories as need based on the repository's file structure when setting the working directory. For more detailed information, consider having a look at Prefect's CI/CD guide and the prefect.deployments.steps.git_clone step for how to handle git branches in your deployment. Links: - https://docs.prefect.io/latest/guides/ci-cd/ - https://github.com/PrefectHQ/prefect/issues/10420 Does that help?