GitLab CI/CD (.gitlab-ci.yml) Pipeline Generator
GitLab CI/CD Automation Hub

GitLab CI/CD (.gitlab-ci.yml) Pipeline Generator

Build production GitLab CI/CD pipelines with multi-stage workflows (build, test, deploy, docker), cache policies, and artifact rules.

GitLab CI Ready
Presets:
Node.js Environment Settings
# ============================================================================
# GitLab CI/CD Pipeline Configuration (.gitlab-ci.yml)
# Synthesized via ToolsAA Flagship Generator (100% Client-Side Engine)
# ============================================================================

include:
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Secret-Detection.gitlab-ci.yml

stages:
  - lint
  - test
  - security
  - build
  - deploy

default:
  image: node:20-alpine
  interruptible: true
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure
  tags:
    - docker
    - saas-linux-medium-amd64

variables:
  FF_USE_FASTZIP: "true"
  ARTIFACT_COMPRESSION_LEVEL: "fast"
  CACHE_COMPRESSION_LEVEL: "fast"
  SAST_EXCLUDED_PATHS: "test, tests, spec, docs"
  NEXT_TELEMETRY_DISABLED: "1"
  CI: "true"

cache:
  key:
    files:
      - pnpm-lock.yaml
  policy: pull-push
  paths:
    - .pnpm-store
    - node_modules/.cache

lint-and-format:
  stage: lint
  timeout: 25m
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG
  before_script:
    - npm install -g pnpm
    - pnpm config set store-dir .pnpm-store
    - pnpm install --frozen-lockfile
  script:
    - pnpm run lint
    - pnpm run typecheck

unit-tests:
  stage: test
  timeout: 25m
  parallel:
    matrix:
      - NODE_VERSION: ["18", "20", "22"]
  image: node:${NODE_VERSION}-alpine
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG
  before_script:
    - npm install -g pnpm
    - pnpm config set store-dir .pnpm-store
    - pnpm install --frozen-lockfile
  script:
    - pnpm test -- --coverage
  coverage: '/Lines\s*:\s*(\d+\.\d+\%)/'
  artifacts:
    reports:
      junit: junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml
    expire_in: 3 days
    when: always

compile-and-package:
  stage: build
  timeout: 25m
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_TAG
  before_script:
    - npm install -g pnpm
    - pnpm install --frozen-lockfile
  script:
    - pnpm run build
  artifacts:
    paths:
      - dist/
      - .next/
      - coverage/
    expire_in: 1 week
    when: on_success

deploy-service:
  stage: deploy
  environment:
    name: production
    url: https://toolsaa.com
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual
  script:
    - echo "Deploying production bundle..."
Pipeline Efficiency
95%+ Fastzip Enabled
Security Score
100 / 100SAST Active
Estimated Speedup
3.5x FasterLockfile Cache

100% Client-Side Privacy

Synthesizes production-grade GitLab CI/CD workflows entirely inside browser memory. Your repository architecture and private credentials never touch external servers.

GitLab CI Native Architecture

Full compatibility with GitLab CI multi-stage execution, DAG dependencies, Kaniko rootless builds, lockfile-based caching, and official security templates.

DevSecOps & Performance Hardened

Automated SAST & Secret Detection injection, fastzip compression acceleration, interruptible redundant job cancellation, and least-privilege rules.

Technical Reference & Architecture Guide

GitLab CI Pipeline Generator Reference — Reference Guide

Authoritative technical reference for generating production-ready GitLab CI/CD pipelines (.gitlab-ci.yml) across Node.js, Python, Go, Rust, and Kaniko container workflows.

Key Parameters & Controls

ecosystem'node' | 'python' | 'go' | 'rust' | 'docker' | 'pages' | 'generic'

Specifies the runtime programming language ecosystem, configuring pre-installed CLI tooling, official base container images, and standard build scripts.

Default: 'node'
nodePkgManager'pnpm' | 'npm' | 'yarn' | 'bun'

Selects the Node.js package manager, configuring lockfile parsing, global store cache paths, and frozen lockfile installation flags.

Default: 'pnpm'
cacheKeyType'branch' | 'job' | 'lockfile'

Configures the cache key generation mechanism, hashing dependencies against the Git commit branch, runner job name, or package lockfile checksum.

Default: 'lockfile'
cachePolicy'pull-push' | 'pull' | 'push'

Determines runner cache transfer behavior; 'pull' downloads existing archives without uploading, while 'pull-push' refreshes storage upon job completion.

Default: 'pull-push'
dockerEngine'kaniko' | 'dind'

Chooses the container image builder: rootless, unprivileged Google Kaniko or daemon-dependent Docker-in-Docker (dind) requiring privileged runners.

Default: 'kaniko'
interruptibleboolean

Enables automatic pipeline cancellation when a newer commit is pushed to the same branch or merge request, conserving runner compute resources.

Default: true

Pro Tips & Best Practices

Leverage Rules Over Only Keyword

Migrate legacy 'only/except' directives to modern 'rules:' arrays with conditional '$CI_COMMIT_BRANCH' checks. The 'rules:' syntax enables fine-grained control over merge request events, manual deployment gates ('when: manual'), and path change detection ('changes:').

Adopt Read-Only Pull Cache Policy

Configure dependency cache keys using 'key: files: [pnpm-lock.yaml]' for hash-based invalidation. In test and lint stages that do not install new packages, set 'policy: pull' to eliminate redundant archive compressions and upload latency at job teardown.

Accelerate DAG With Needs Keyword

Bypass rigid stage barriers by declaring 'needs: [job_name]' on independent jobs. Downstream stages execute immediately upon prerequisite job completion without waiting for unrelated jobs running in preceding stages, creating an efficient Directed Acyclic Graph.

Enforce Rootless Kaniko Builds

Replace Docker-in-Docker daemon configurations with Google Kaniko ('gcr.io/kaniko-project/executor:debug'). Kaniko builds and pushes container images entirely within unprivileged user space, avoiding dangerous 'privileged = true' runner daemon privileges.

Common Gotchas & Troubleshooting

Runner stuck in pending status: "This job is stuck because you don't have any active runners online with any of these tags"

Navigate to Project Settings > CI/CD > Runners and inspect runner tag definitions. Either assign the matching tag specified in runnerTags to your GitLab Runner, or configure the runner with "Run untagged jobs: true" if executing without explicit tags.

YAML validation failure: "jobs:job_name config should implement a script: or a trigger: keyword"

Every executable pipeline block must define an executable 'script:' array or child 'trigger:'. If defining reusable shared scaffolding, prefix the YAML job identifier with a dot (e.g., '.base_job:') to declare it as an uninstantiated hidden template inherited via 'extends:'.

Docker daemon connection error: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock"

When configuring Docker-in-Docker ('dind'), verify that the runner executor has 'privileged = true' enabled in config.toml, export 'DOCKER_HOST: tcp://docker:2375', and disable TLS certificates by setting 'DOCKER_TLS_CERTDIR: ""'.

Frequently Asked Questions

What distinguishes GitLab CI cache from artifacts during multi-stage pipeline execution?▼

Cache stores ephemeral dependencies (like node_modules or .cache directories) between runs on the runner host or S3 backend and may expire or miss without breaking pipeline completion. Artifacts are deterministic, immutable build deliverables and test reports stored on the GitLab coordinator and passed sequentially between dependent stages.

How does the 'needs' keyword optimize stage execution compared to default linear pipelines?▼

Standard pipelines enforce strict stage barriers where all jobs in stage N must terminate before stage N+1 starts. Declaring 'needs: [job_name]' establishes a Directed Acyclic Graph (DAG), letting downstream jobs trigger the millisecond their explicit prerequisites finish, irrespective of lingering concurrent jobs in earlier stages.

How can merge request pipelines be prevented from duplicating push pipeline runs?▼

Define top-level 'workflow:rules:' using conditional expressions: allow execution when '$CI_PIPELINE_SOURCE == "merge_request_event"' or when pushing to default branches without open merge requests. This eliminates concurrent double-pipeline execution on open merge requests.

Why should container builds prefer Kaniko over Docker-in-Docker in Kubernetes environments?▼

Docker-in-Docker requires runner containers to operate in privileged root mode, which violates container security policies and creates cluster escape risks. Google Kaniko builds Docker images entirely in user space inside unprivileged containers without requiring access to a Docker daemon or host socket.

Related Tools & Utilities

All Tools →