GitLab CI Integration

Provider Integration

When GITLAB_CI=true, cikit selects GitLabProvider. Project, pipeline and revision metadata are obtained from GitLab CI environment variables. The complete mapping is described in Providers.

CiSection emits GitLab section markers, including the optional initial collapsed state. Commands do not need to generate these markers themselves.

Job Artifacts

GitLab jobs can publish the complete cikit output directory as job artifacts. For the default PUBLIC_DIR configuration:

artifacts:
  when: always
  paths:
    - public

when: always also retains available output from failed jobs. Subsequent jobs can obtain the output through GitLab artifact downloads. For example, with the required tools already available in the job environment:

stages: [init, lint, doc]

init:
  stage: init
  script:
    - uv run cikit init

lint:
  stage: lint
  script:
    - uv run cikit ruff src tests
  artifacts:
    when: always
    paths:
      - public
    reports:
      codequality: public/artifacts/ruff-codequality.json

documentation:
  stage: doc
  needs:
    - job: lint
      artifacts: true
  script:
    - uv run cikit sphinx docs
  artifacts:
    paths:
      - public

The documentation job receives the lint artifacts and their registry together. Adjust the artifact paths when using a custom PUBLIC_DIR. See Artifacts for the common artifact model.

GitLab Code Quality

The built-in ruff and pylint commands generate GitLab Code Quality JSON when the GitLab provider is active. Pylint additionally requires pylint-gitlab; Ruff supports the output format directly.

Register the generated file with the GitLab job’s artifacts.reports.codequality setting. The default paths are:

Command

Report

Ruff

public/artifacts/ruff-codequality.json

Pylint

public/artifacts/pylint-codequality.json

GitLab CI/CD Variables

Configure CIKIT_DATA_BASE_URL and, when authentication is required, CIKIT_DATA_API_TOKEN through GitLab CI/CD variables if remote cikit data is used. Store the token outside the repository and apply the appropriate masking and protection settings.

The common configuration and data addressing rules are described in Cikit Data.

GitLab Pages

GitLab Pages can publish generated Sphinx documentation directly from a registered HTML folder artifact. For example, with the default public directory and Sphinx run name:

deploy-pages:
  stage: deploy
  needs:
    - job: documentation
      artifacts: true
  script:
    - test -d public/artifacts/sphinx-html
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  pages:
    publish: public/artifacts/sphinx-html

This example assumes a deploy stage and a preceding documentation job that publishes the complete public directory. It uses GitLab’s pages.publish syntax; adjust it to the installed GitLab version and project configuration. Pages deployment is handled by GitLab, not by cikit.