What is the recommended way to update Prefect Depl...
# prefect-cloud
e
What is the recommended way to update Prefect Deployments in CI/CD? For example, after I build a new image I want to update the Deployment to point to it. The docs show how to do it manually (log into prefect in terminal and then do `prefect deploy`; what credentials should we use for programatic push?
1
Locally, I've been using a Python script to created the deployment like:
Copy code
if __name__ == "__main__":
    
    deployment: Deployment = Deployment.build_from_flow(
        flow=compile_and_analyze,
        name="compile_feedback",
        version="0.1",
        tags=["feedack"],
        work_pool_name='eric-local-work-pool',
        # overwrite=True
    )

    deployment.apply()
But this still required me to manually authenticate before
I'm planning to use a prefect.yaml file to configure the deployment
j
hey! You can create an API key https://docs.prefect.io/latest/cloud/users/api-keys/?h=api and then login with
prefect cloud login --key <api_key> --workspace '<account_handle>/<workspace_handle>'
alternatively you're able to set the environment variables directly in CI/CD e.x.
Copy code
PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/{account_id}/workspaces/{workspace_id}>"

PREFECT_API_KEY="<api key goes here>"
e
Perfect, thank you!
👍 1