Skip to main content

GitLab CI

GitLab CI runs the Mankinds gate through the ghcr.io/mankinds/ci container image. The image wraps the public /api/v1/agents/{agent_id}/runs calls and returns the right CI exit code.

1. Store the API key as a CI/CD variable

In your project:

  1. Settings → CI/CD → Variables → Add variable.
  2. Key: MANKINDS_API_KEY.
  3. Value: the key copied from Mankinds at creation.
  4. Tick Protect variable (so it is only injected into protected branches) and Mask variable (so it never appears in job logs).

2. Add the job to .gitlab-ci.yml

mankinds_eval:
image: ghcr.io/mankinds/ci:v1
stage: test
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
script:
- mankinds-ci --agent 00000000-0000-4000-8000-000000000000
variables:
MANKINDS_API_KEY: $MANKINDS_API_KEY

Replace 00000000-0000-4000-8000-000000000000 with your agent UUID. The job exits 0 when the gate passes and 1 when it fails, which marks the pipeline accordingly.

3. Block merges on a failed gate (optional)

To enforce the gate on merge requests, enable Settings → Merge requests → Pipelines must succeed and keep the mankinds_eval job on merge request pipelines targeting main.

Options

The required flag is --agent. The command also accepts:

  • --base-url: override https://app.mankinds.io for another deployment.
  • --timeout-minutes: maximum wait time before the job fails.

The API key is read from MANKINDS_API_KEY; prefer the CI/CD variable over an inline --api-key.

Container image

docker run --rm \
-e MANKINDS_API_KEY=$MANKINDS_API_KEY \
ghcr.io/mankinds/ci:v1 \
--agent 00000000-0000-4000-8000-000000000000

Use the major tag :v1 in CI. The same image can be run locally when you need to reproduce a gate result outside GitLab.

See also