Hi! Does anybody know what’s the best way to initi...
# ask-community
n
Hi! Does anybody know what’s the best way to initiate/run prefect job from gitlab ci/cd pipeline?
1
f
Copy code
prefect-run:
  # Use the official prefect image.
  image: prefecthq/prefect:latest
  before_script:
    - prefect auth login --key "$PREFECT_SERVICE_ACCOUNT_TOKEN"

  script:    
    - prefect run --name "$NAME_OF_FLOW"
I'm not great at Gitlab ci/cd, but something like this should work quite well.
upvote 2
z
The API key can also just be provided as an environment variable secret without the
login
call
You'll probably want to include
--watch
so that CI doesn't finish until the flow does and the exit code will reflect the status of the run then. Without
--watch
, it just creates a flow run and exits.
n
thanks a lot!