Manual / Guides

The MLOps workflow and CI/CD

Two questions decide whether ML in production can be trusted: what can start a model run, and who said yes to the last one. In Pipewright every run, whatever starts it, goes through one door, the launcher, which applies the environment’s rules. The pipeline’s stages check themselves, a person decides where a decision has consequences, and every step leaves an event. The flow is the same whether a use case trains a custom model, runs on Ray, uses BigQuery ML or runs on Kubeflow on GKE: only the pipeline’s runner differs.

Every way a run starts: pull request, merge, schedule, a file landing, the API or CLI, monitoring signals and A/B tests. Run requests, landing notifications and approver decisions travel over Pub/Sub to the launcher, which routes the request, can hold a scoring run for a person, checks integrity and feature contracts, handles retrain cases and registration, then submits the training or scoring pipeline on Vertex AI Pipelines or Kubeflow. GitHub workflows list pending decisions and run each after the environment's reviewers approve; promotion needs production's reviewers. Every step sends an event to a topic, the event log, team subscriptions and alerts.
Every way a run starts, and where a person says yes. Amber steps wait for a person; green steps are automatic checks that refuse. Open the image for full size.

How a run starts

TriggerHow it reaches the launcherWho can start it
A merge to mainpipewright-release writes the release contract, schedules and alertsthe release workflow, after the environment’s reviewers
A scheduleCloud Scheduler (or a CronJob on private GKE) sends a run requestthe release that created it
A file landsthe landing bucket’s notification over Pub/Sub; the longest matching prefix picks the use casewhoever may write to the tenant’s landing prefix
The API or CLIpipewright run or POST /run; a private launcher takes requests over its run requests topicoperators and CI, as their own identities
A signaldrift, performance or serving health opens a retrain case or a rollback proposalnobody: a person decides the case

The launcher knows the live release of every use case and the environment’s rules. It submits every run as the team’s runner identity, never as itself or as the person who asked; the same request twice starts once; a refusal is an event that says why.

Stages that check themselves

StageThe checkGuide
Validate datathe data contract; a bad file fails the runData and features
Trainfeatures as approved (feature contracts); custom container, Ray or BigQuery MLPipelines and runs
Evaluatemetric, slice and fairness gates; the championEvaluation and approvals
Registerwith policies.registration: launcher, runners cannot write the registry; the launcher checks the run, its files and its gates firstIntegrity
Scoreonly with an approved version and its approved files (integrity.inference)Integrity

Where a person decides

pipewright decisions pending --env <env> lists everything that waits for a person. The pipewright-decisions workflow runs it on a schedule and dispatches one pipewright-gate run per decision; that run waits for the GitHub environment’s reviewers, then reads the list again and runs the decision’s own command, only if it is still pending. The reviewers, their comment and the run link are recorded on the decision’s event.

DecisionListed asCommand it runs
A version becomes the defaultmodel-approvepipewright model approve
Deploy to an endpoint (approvals.deploy_model: ci)deploy-approvepipewright deploy-model --approve
A retrain drift proposedretrain-approvepipewright retrain approve
The closed loop’s promotionloop-approvepipewright loop advance --approve
An A/B decisionab-decide, ab-concludepipewright ab decide, conclude
A held scoring run (1.4.3)score-approvepipewright scoring approve

Releases and promotions are gated by the environment the workflow runs in: pipewright-release waits for the target environment’s reviewers, pipewright-promote for production’s.

Scoring runs that wait for a person

With approvals.batch_scoring: manual (or the platform’s policies.batch_scoring: manual) the launcher holds every scoring run, whatever started it, until a reviewer approves it in the gate workflow or with pipewright scoring approve. Use it where scores act on their own, such as letters, prices or credit limits; the cost is a person deciding every run. How it works and what it costs.

The workflows

pipewright ci init --environments test,prod writes six workflows into your repository. Every job runs under a GitHub environment named after the Pipewright environment, so its reviewers decide.

WorkflowWhenGitHub environmentWaits for a reviewer
pipewright-prevery pull requestthe first environment, or --checks-environmentif that environment has reviewers (see below)
pipewright-releaseon mergeeach environment in turnyes, where it has reviewers
pipewright-operateby handthe one chosenyes, where it has reviewers
pipewright-decisionson a schedule<env>-decisionsno: it only lists and dispatches
pipewright-gateone per decision<env>, or <env>-<group> for an approver groupyes: that is its job
pipewright-promoteby handproductionyes

Setting up the GitHub environments

  • Variables. Each environment needs GCP_WIF_PROVIDER, PIPEWRIGHT_SERVICE_ACCOUNT and PIPEWRIGHT_PIP_SPEC; the -decisions environments the same as their environment. Sign-in is Workload Identity Federation, so there are no keys.
  • Reviewers. Add required reviewers to every environment whose changes a person should approve, and turn on “Prevent self-review” where the author must not approve their own change. Required reviewers need a public repository or a paid GitHub plan for private ones.
  • Pull request checks. The checks run under the first environment. If it requires a reviewer, every pull request waits for one before its checks start. To keep checks automatic, run pipewright ci init --environments test,prod --checks-environment test-checks and give test-checks the first environment’s variables and no reviewers: the checks still run against test, and start at once (1.4.3).
  • Leave the -decisions environments without reviewers. The decisions workflow decides nothing; the gate it dispatches does.

The same flow on Google Cloud

The same flow on Google Cloud services: GitHub Actions and GitHub environments sign in through Workload Identity Federation; Cloud Scheduler and a landing bucket send Pub/Sub messages to the launcher on Cloud Run; the launcher reads release contracts from the artifacts bucket and submits pipelines on Vertex AI or GKE as the team's runner; BigQuery holds data, features and scores; Cloud Monitoring and every step send events to a Pub/Sub topic, a BigQuery event log, Fleet View and team subscriptions.
The same flow on Google Cloud services, numbered from a merge to production. Fleet View is part of Pipewright Enterprise.

What changes from one organisation to the next

The lifecycle stays the same; the wiring around it is yours: how many environments and which promotes into which, the reviewers of each, one identity per team and environment, hosted or self-hosted runners (ci init --runs-on), your branching and release triggers, and steps of your own such as a security scan or a change ticket. A team on another CI system runs the same pipewright commands in the same six jobs.

Related: Releases, promotion and CI, Evaluation and approvals, Events, lineage and reports, Events reference.