GitLab CI/CD¶
whatifd ships a GitLab CI/CD Catalog component (the GitLab analog of the GitHub Action) that runs whatifd fork in a pipeline, gates on the verdict exit code, uploads the report artifacts, and posts the verdict as a merge-request note.
The canonical component source lives in the whatifd repo at integrations/gitlab/templates/whatifd-fork.yml. Publication to a GitLab CI/CD Catalog project is an operator step (a dedicated GitLab project marked as a catalog resource).
Usage¶
# .gitlab-ci.yml
include:
- component: $CI_SERVER_FQDN/<group>/whatifd-gitlab/whatifd-fork@1
inputs:
config: whatifd.config.yaml
pip-install: "whatifd whatifd-langfuse" # + the adapter you use
Provide adapter credentials (and optionally GITLAB_TOKEN) as masked CI/CD variables.
Inputs¶
Input |
Default |
Purpose |
|---|---|---|
|
|
Pipeline stage to run in. |
|
|
Image (Python 3.11+). |
|
|
whatifd config path. |
|
|
Space-separated install spec; add your adapter, e.g. |
|
|
Fail the job on Don’t-Ship / Inconclusive (exit 1 / 2). |
|
|
Post the verdict as an MR note (MR pipelines only). |
Behavior¶
Runs
whatifd fork --config <config> --print-paths; the exit code (0=ship /1=dont_ship /2=inconclusive) is the gate.Uploads
reports/as a job artifact (when: always).On merge-request pipelines, posts/updates a single MR note, deduped by a hidden
<!-- whatifd-fork -->marker found via the GitLab Notes API — one rolling note per MR, locale- and author-independent.
No curl/jq required: the note poster uses Python stdlib, so the default slim image works.
Tokens (MR note)¶
Posting a note needs a token with notes scope:
CI_JOB_TOKEN(built-in) is used by default and works on many GitLab setups.GITLAB_TOKEN(a project/group access token withapiscope) takes precedence when set — required on instances where the job token can’t post notes. Set it as a masked CI/CD variable.
Generic CI¶
If you don’t want the component, whatifd fork’s exit code (0/1/2) gates any CI directly — see Path Z. --print-paths and --output-json / --output-md make capturing the report straightforward in any runner (see the CLI reference).