cki_tools.sprinter

Implement the CKI workflow

This webhook enforces the CKI workflow and manages the CWF::* labels on issues and merge requests.

Iterations

The webhook listens to closed issues and assigns them to the current sprint if they are not assigned to an iteration yet.

Incident labels

The webhook listens to issue updates and updates the CWF::Incident::* and CWF::Type::Incident labels so they stay consistent when using the

incident board:

  • if an open issue is tagged with CWF::Incident::*, tag with CWF::Type::Incident
  • if an open issue is tagged with CWF::Type::Incident, but no CWF::Incident::*, tag with CWF::Incident::Active
  • if the CWF::Type::Incident label is removed from an open issue, remove any CWF::Incident::* labels
  • if an issue is closed, remove CWF::Incident::*

Team labels

The webhook listens to issue updates and adds correct CWF::Team::* labels:

  • if an issue is not already tagged with CWF::Team::*, tag with CWF::Team::* depending on the project/group as specified in the configuration

Stage labels

The webhook listens to issue updates and ensures correct CWF::Stage::* labels:

  • if an issue is closed, remove CWF::Stage::*

The webhook listens to merge request changes and enforces the presence of an issue link in the merge request description.

The resulting labels are CWF::Issue::OK (link found) or CWF::Issue::Missing (link missing). Labels are updated on changes to the merge request. A label update can be requested by manually removing the current label from the merge request.

Automatic weights

The webhook listens to issue updates and adds a default weight if missing.

Usage

usage: python3 -m cki_tools.sprinter [-h] [--validate]

options:
  -h, --help         show this help message and exit
  --validate         only validate configuration and exit

Configuration

The configuration in SPRINTER_CONFIG can be provided in YAML or JSON format:

---
# select projects for MR issue checks
issue_checks:
  # project-level rule
  - project: https://instance/group/project
    enabled: false  # defaults to enabled
  # all projects beneath the group
  - group: https://instance/group
    enabled: false
  # add labels at project level instead of group
  - project: https://instance/group/foo
    level: project
  # only for issues that belong to a certain team
  - team_label: 'CKI'
  # disable for everything else
  - enabled: false
# select projects for issue sprint labels
sprint_labels: []
# select projects for issue incident labels
incident_labels: []
# select projects for issue type labels
type_labels:
  # add a certain issue type label
  - project: https://gitlab.com/cki-project/kernel-ark
    type: 'ARK'
# select projects for automatic weights
automatic_weights:
  - project: https://gitlab.com/cki-project/cki-tools
    weight: 5
labels:
  - name: CWF::Team::CKI
    color: '#6699cc'
    description: "This issue belongs to the CKI team."

Environment variables

Environment variable Secret Required Description
SPRINTER_CONFIG no yes Configuration in YAML, falls back to SPRINTER_CONFIG_PATH
SPRINTER_CONFIG_PATH no no Path to a single configuration YAML file
GITLAB_TOKENS no yes URL/environment variable pairs of GitLab instances and private tokens
GITLAB_TOKEN yes yes GitLab private tokens as configured in GITLAB_TOKENS above
RABBITMQ_HOST no yes RabbitMQ host
RABBITMQ_PORT no no RabbitMQ port, TLS is used for port 443
RABBITMQ_USER no yes RabbitMQ user
RABBITMQ_PASSWORD yes yes RabbitMQ password
RABBITMQ_CAFILE no no RabbitMQ CA file path
RABBITMQ_CERTFILE no no RabbitMQ certificate + private key file path
CKI_DEPLOYMENT_ENVIRONMENT no no Define the deployment environment (production/staging)
CKI_LOGGING_LEVEL no no logging level for CKI modules, defaults to WARN
SENTRY_SDN yes no Sentry SDN

CKI_DEPLOYMENT_ENVIRONMENT

On non-production deployments (CKI_DEPLOYMENT_ENVIRONMENT != production), no changes to GitLab objects are made.