Thread
#prefect-community
    n

    Nikolay

    1 year ago
    Hi! Does anybody know what’s the best way to initiate/run prefect job from gitlab ci/cd pipeline?
    Filip Lindvall

    Filip Lindvall

    1 year ago
    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.
    Michael Adkins

    Michael Adkins

    1 year ago
    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

    Nikolay

    1 year ago
    thanks a lot!