Skip to main content

Generic GitLab CI/CD

Define your projects and checks. Generate a reviewable GitLab pipeline.

Generic GitLab CI/CD is a Python toolkit that turns a small delivery configuration into a committed .gitlab-ci.yml. It connects your existing test commands, application builds, package publication, container builds, and Helm deployments while keeping infrastructure settings separate from application configuration.

The package is named generic-gitlab-cicd; the command is generic-ci. GitLab and your runners execute the generated pipeline. The CLI validates and generates configuration locally.

Quick start · Workflow guide · CLI reference · Examples · Documentation

One repository. Tests, packages, and deployment.

Keep your shared Python package and API together. Generic CI tests them, publishes the package on release, and deploys the API to OpenShift.

version: 1

projects:
  sdk:
    path: packages/sdk
    python: {}
    checks:
      tests:
        script: [uv run --no-sync pytest]
    package:
      index: internal
    release:
      tag: v{version}
    workflows:
      merge-request:
        checks: [tests]
      release:
        checks: [tests]
        publish: true

  api:
    path: services/api
    depends-on: [sdk]
    python: {}
    checks:
      tests:
        script: [uv run --no-sync pytest]
    container:
      dockerfile: Dockerfile
    release:
      tag: v{version}
      needs: [sdk]
    workflows:
      merge-request:
        checks: [tests]
      release:
        checks: [tests]
        build: [container]

deployments:
  api:
    target: production
    chart:
      path: deploy/chart
    values: [deploy/values.yaml]
    images:
      - from: api.build-image
        set:
          repository: apps.api.image.repository
          tag: apps.api.image.tag
    workflows:
      release:
        when: manual

What you get:

  • On merge requests: test affected projects. SDK changes also select the API for testing.
  • On a release tag: run checks, publish the SDK, and build the API image. The API release depends on SDK publication; its tests and image build can run independently.
  • When you approve deployment: deploy the built API image through Helm to OpenShift.

Both projects use a shared version: projects at 1.2.0 release under the protected tag v1.2.0. Dependency installation follows each project's declared dependencies and committed lockfile; depends-on selects work, not package replacements.

Your organization supplies prepared runtime images, registry settings, and the production target in ci-platform.yml. The application's deploy/chart and deploy/values.yaml describe the deployment. Start with the shared chart and values example; configure the named internal publishing index and CI credentials through your platform.

Quick start

Use Python 3.11 or newer. From a checkout of this toolkit, install the CLI into an isolated environment:

python -m venv .venv
. .venv/bin/activate
python -m pip install .

Then, from your application repository:

generic-ci setup

Setup guides you through organization templates or standalone configuration, previews files before writing, and includes local editor schemas. Start with its single-app configuration and add projects as needed, or choose an organization template for your monorepo. See the setup guide for prepared images, unattended options, and editor integration.

After editing your configuration:

generic-ci validate
generic-ci render -o .gitlab-ci.yml

Review and commit delivery.yml, your platform configuration, and the generated .gitlab-ci.yml together. Validate the generated pipeline with your GitLab CI Lint, then push your branch.

Prefer autocomplete? Setup exports the schemas automatically. You can also refresh them from the installed CLI:

generic-ci schema -o .generic-ci/delivery.schema.json
generic-ci schema --platform-schema -o .generic-ci/platform.schema.json

Associate them with delivery.yml and ci-platform.yml in your editor. The editor guide includes PyCharm instructions.

Add the delivery features you need

Goal Configuration / next step
Test Node, pnpm, or Bun projects Declare node.package-manager, commit the corresponding lockfile, and use your existing commands; see the workflow guide
Build application artifacts Set build.script and build.outputs; select build: [application] in the workflow
Retest downstream projects Add project depends-on: [sdk]; this propagates change selection
Transfer generated files to another job Add check/build needs: [sdk.build]; the producer must be enabled in the same event
Build and push containers Configure container and select build: [container]; the default builder is Buildah
Publish Python or npm-compatible packages Configure package and workflow publish; see publication behavior
Coordinate releases Configure project versions, tag conventions, and optional release.needs; see the release workflow
Deploy to OpenShift Configure a Helm deployment, target, values, and image bindings; start with the deployment example and chart values

depends-on and needs have different jobs: the first selects affected projects; the second transfers explicit same-event outputs. Neither implicitly installs an unreleased package. Candidate dependency testing has a separate contract described in the workflow guide.

Share organization defaults

An organization source can provide platform defaults and starter templates. Initialize from a reviewed source revision:

generic-ci init --repo ssh://git@gitlab.example.internal/platform/ci-config.git \
  --ref v1.0.0 --template python-service

The repository, ref, and template name above are examples; the source must contain the toolkit's source manifest. Initialization copies starter files and records an exact source commit. Commit the resulting descriptor and lockfile. Later source updates change inherited defaults while preserving consumer-owned template files.

For disconnected authoring, cache the locked source or import a Git bundle, then render with --offline. This flag controls configuration-source acquisition; it does not enforce network isolation inside application jobs. See configuration sources for source layout, registration, updates, and offline setup.

OpenShift deployment

The bundled generic-app chart supports multiple applications, Services, OpenShift Routes with TLS, probes, resources, ports, volumes/mounts, and pod labels/annotations. Images use repository + tag; Buildah also records the pushed digest as evidence. Security contexts are configurable, with cluster defaults applying when unset.

Helm deployments support complete updates and partial updates that preserve unchanged service images. Partial updates require a compatible existing baseline; chart or configuration changes require a complete deployment. Production requires a protected ref, and candidate dependency runs cannot update persistent deployments.

You supply registry credentials, CA trust, a kubeconfig, namespace resources, and application values. The toolkit does not provision the cluster, issue certificates, create PVCs automatically, or make multi-project publication transactional. Keep release image tags immutable: the shared chart uses IfNotPresent.

Existing component users

The repository also contains low-level GitLab CI/CD components and the older compiler, available through --format legacy. They are separate interfaces from the workflow configuration above. New users should start with the CLI walkthrough.

Mirror components into your GitLab instance and pin includes to an immutable revision. Consult the component air-gap guide for setup. Older BuildKit/digest-only Helm adapters target chart 1.x; the current chart uses OpenShift Routes and repository/tag values. Do not mix those contracts without migrating the configuration.

Development and validation

From a toolkit checkout with Python, Git, Node/npm, rsync, and Helm available:

python -m pip install . build twine uv setuptools
npm ci --ignore-scripts --no-audit --no-fund
python scripts/sync_embedded.py --check
python scripts/sync_authoring_skill.py --check
python -m unittest discover -s tests -v
npm run test:ci-local

The local pipeline fixtures use pinned gitlab-ci-local. Real GitLab/Runner E2E runs are deliberate, through workflow dispatch or an opt-in PR label. Use focused tests while iterating; see testing commands and evidence for prerequisites, integration tests, release checks, and scenario selection.

Version 0.3.2 passed fast CI and six real GitLab E2E scenarios. That evidence covers the tested pipeline fixtures, not deployment to your registry or OpenShift cluster. Qualify Buildah execution, registry access, Route admission, and rollout/rollback on your infrastructure before production use. Workflow runtime execution currently targets Linux; Windows workflow execution is not supported.

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generic_gitlab_cicd-0.3.4.tar.gz (73.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generic_gitlab_cicd-0.3.4-py3-none-any.whl (62.8 kB view details)

Uploaded Python 3

File details

Details for the file generic_gitlab_cicd-0.3.4.tar.gz.

File metadata

  • Download URL: generic_gitlab_cicd-0.3.4.tar.gz
  • Upload date:
  • Size: 73.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for generic_gitlab_cicd-0.3.4.tar.gz
Algorithm Hash digest
SHA256 af95482f1fa13ad1a9b8bf4b969f888d0cdae740f5cfad2e23cf51ace6e4511c
MD5 cd4aad6dce65eb5b8433ac2234af1bda
BLAKE2b-256 2dd466332696a7a6f4bdda5a44cd85fd52fa252657789527767a129c9f31ef8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for generic_gitlab_cicd-0.3.4.tar.gz:

Publisher: publish.yml on Heknon/generic-gitlab-cicd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file generic_gitlab_cicd-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for generic_gitlab_cicd-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f93a316efac5a3ae380e1711cd9c58ebd849ba6102fdff8e70610260aa66f1b6
MD5 bce3c903e4343a6cc00e326627481191
BLAKE2b-256 3ba957ab7086874e1e4b259188ee07e7d6741c8f8903ce9739c11221bacb80d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for generic_gitlab_cicd-0.3.4-py3-none-any.whl:

Publisher: publish.yml on Heknon/generic-gitlab-cicd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 files

0.3.3

2 files

0.3.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page