Skip to content

GitLab CI/CD

The GitLab CI/CD lexicon provides typed constructors for GitLab CI pipeline configuration. It covers jobs, workflow settings, artifacts, caching, images, rules, environments, triggers, and more.

Install it with:

Terminal window
npm install --save-dev @intentius/chant-lexicon-gitlab
quickstart.ts
import { Job, Image, Cache, Artifacts, CI } from "@intentius/chant-lexicon-gitlab";
export const testJob = new Job({
stage: "test",
image: new Image({ name: "node:20" }),
cache: new Cache({ key: CI.CommitRef, paths: ["node_modules/"] }),
script: ["npm ci", "npm test"],
artifacts: new Artifacts({
paths: ["coverage/"],
expire_in: "1 week",
}),
});

The lexicon provides 3 resources (Job, Workflow, Default), 16 property types (Image, Cache, Artifacts, Rule, Environment, Trigger, Need, Service, and more), the CI pseudo-parameter object for predefined variables, and the reference() intrinsic for YAML !reference tags.

MetricCount
Resources3
Property types16
Services1
Intrinsic functions1
Pseudo-parameters0
Lint rules23

Lexicon version: 0.0.22
Namespace: GitLab