Hello All, I am trying to automate the deployment ...
# ask-community
r
Hello All, I am trying to automate the deployment creation using prefect client and python. I am using prefect 3.0.3. But I am strugling with the pull_steps to point to a git repo. I dont know what it is expecting or the format. await client.create_deployment( flow_id="f568ff3c-ffe6-485a-8f0b-xxxxxxx", name=deployment_name, # Deployment name parameters={"server_name": servers}, # Pass server names as parameters schedules=rrule, # Pass the RRule schedule for deployment pull_steps= {"git_clone": {"repository": "https://github.com/xxxxx/xxxxx", "credentials": github_token}} #github_storage # Use the GitHub storage block ) Any advise?
b
Hi Richard, thanks for posting! I'm curious if you've already considered using the
.deploy()
method to deploy your flows? ie:
Copy code
from prefect import flow
from prefect.runner.storage import GitRepository
from prefect_github import GitHubCredentials


if __name__ == "__main__":

    github_repo = GitRepository(
        url="<https://github.com/org/my-private-repo.git>",
        credentials=GitHubCredentials.load("my-github-credentials-block"),
    )

    flow.from_source(
        source=github_repo,
        entrypoint="gh_credentials_block.py:my_flow",
    ).deploy(
        name="private-github-deploy",
        work_pool_name="my_pool",
        parameters={"server_name": servers},
        rrule="FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9;BYMINUTE=0"
    )
the
.from_source()
method is defining the repository you'd like to pull the code from
r
Thanks Bianca, let me try it out.