Home › Developer Tools › GitLab CI Config Generator

GitLab CI Config Generator

Pick a template and shape your pipeline with a form: stages, a default image, a lock-file cache, and jobs with scripts, artifacts, JUnit reports, needs and rules. The .gitlab-ci.yml updates as you type and is checked for common mistakes such as unknown stages or broken needs.

Last updated:

Pipeline

Jobs

.gitlab-ci.yml

    Advertisement
    Advertisement

    How to use the GitLab CI Config Generator

    1. Choose a template such as Node.js, Python or Docker image to start with sensible jobs.
    2. Set the pipeline basics: the list of stages, the default image, the cache and any global variables.
    3. Edit the jobs: name, stage, script lines and when they run. Open More options for services, needs, reports and environments.
    4. Add, duplicate, reorder or delete jobs and watch the stage overview and the YAML update.
    5. Fix any red notes, then copy or download the file and commit it as .gitlab-ci.yml in the repository root.

    Key .gitlab-ci.yml keywords

    KeywordWhat it doesExample
    stagesOrder in which groups of jobs run[test, build, deploy]
    defaultSettings inherited by every job, such as image, cache and interruptibleimage: node:20-alpine
    variablesEnvironment variables for all jobs or one jobPIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    scriptShell commands the job runs (required)- npm test
    before_scriptCommands run before script, in the same shell- docker login …
    servicesExtra containers available during the jobpostgres:16, docker:27-dind
    cacheFiles reused between pipelines to save download timekey: {files: [package-lock.json]}
    artifactsJob output passed to later jobs and kept for downloadpaths: [dist/], expire_in: 1 week
    needsStart as soon as these jobs finish, ignoring stage orderneeds: [build]
    rulesDecide whether a job is added to a pipeline, and how- if: $CI_COMMIT_TAG
    environmentTrack deployments to an environmentname: production
    workflowRules for whether the whole pipeline is createdAvoid duplicate MR and branch pipelines

    Useful predefined CI/CD variables

    VariableValue
    $CI_DEFAULT_BRANCHThe project's default branch, usually main
    $CI_COMMIT_BRANCHBranch name in branch pipelines (not set in merge request or tag pipelines)
    $CI_COMMIT_TAGTag name, only in tag pipelines
    $CI_PIPELINE_SOURCEWhat started the pipeline: push, merge_request_event, schedule, web…
    $CI_COMMIT_REF_SLUGBranch or tag name made safe for URLs and cache keys
    $CI_COMMIT_SHORT_SHAFirst 8 characters of the commit SHA, handy as an image tag
    $CI_PROJECT_DIRFull path where the repository is cloned in the job
    $CI_REGISTRY_IMAGEAddress of the project's container registry image

    Tips for faster, safer pipelines

    • Pin image versions (node:20-alpine, not node:latest) so a new upstream release cannot break a pipeline overnight.
    • Use needs to let independent jobs run in parallel instead of waiting for whole stages.
    • Give artifacts an expire_in so old build output does not fill your storage quota.
    • Publish test results with artifacts:reports:junit to see failures directly in merge requests.
    • Keep deploy jobs on the default branch and make production deploys manual until you trust the pipeline.

    Frequently asked questions

    Where do I put the .gitlab-ci.yml file?

    Commit it to the root of your repository with exactly that name. GitLab detects it on the next push and starts a pipeline using the shared or project runners available to the project. You can preview and validate it in GitLab under Build, Pipeline editor.

    What is the difference between stages and needs?

    Stages run in order: every job in one stage waits until all jobs in the previous stage have finished. needs lets a job start as soon as the specific jobs it lists are done, even if other jobs in earlier stages are still running, which shortens pipelines. A job can only need jobs in the same or an earlier stage.

    How does caching differ from artifacts?

    A cache speeds up jobs by reusing downloaded dependencies such as .npm or .m2 between pipelines, but it is best-effort and may be missing. Artifacts are the outputs of a job, such as a dist folder or test report, and are reliably passed to later jobs in the same pipeline and kept for download until they expire.

    Why use cache:key:files with a lock file?

    With key: files, GitLab builds the cache key from the content of the listed files, such as package-lock.json. The cache is reused until the dependencies change, and a new cache is created automatically when they do. You can list up to two files.

    What do the workflow rules do?

    Without them, pushing to a branch that has an open merge request can start two pipelines: a branch pipeline and a merge request pipeline. The generated workflow rules run merge request pipelines, skip branch pipelines while a merge request is open, and still run pipelines for other branches and tags.

    How do I use secrets in the pipeline?

    Do not write passwords or tokens in .gitlab-ci.yml. Add them in GitLab under Settings, CI/CD, Variables, mark them as masked and protected, and reference them in scripts as $MY_TOKEN. Predefined variables such as $CI_REGISTRY_USER and $CI_REGISTRY_PASSWORD are provided automatically for the project's container registry.

    Why does a job need a script?

    Every regular job must have a script section with at least one command; GitLab rejects the configuration otherwise. The only exceptions are trigger jobs that start another pipeline. Hidden jobs whose names start with a dot are templates for extends and do not run.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    GitHub Actions Workflow GeneratorBuild a GitHub Actions CI workflow: triggers, matrix, caching, tests, Pages or Docker deploy.Dockerfile LinterLint a Dockerfile for best practices: pinned tags, apt cleanup, non-root USER and layer count.YAML Validator & FormatterValidate, format and minify YAML, and convert YAML to JSON or back.Docker Compose GeneratorBuild a docker-compose.yml with a form: services, ports, volumes, env, healthchecks and presets.QR Code GeneratorMake QR codes for links, Wi-Fi, email and more.Barcode GeneratorCreate Code 128, EAN-13, UPC-A, EAN-8, Code 39 and ITF-14 barcodes as PNG or SVG.UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Schema Markup Generator (JSON-LD)Create JSON-LD structured data for FAQ, Product, Article and more.Htaccess & Nginx Redirect GeneratorBuild 301 redirects for .htaccess, Nginx and Netlify or Cloudflare _redirects.Fake Data GeneratorGenerate mock data as JSON, CSV or SQL.Random String GeneratorGenerate secure random strings and tokens in bulk with any length and character set.API Key GeneratorCreate secure API keys and secrets with prefixes, checksums and SHA-256 hashes for storage.MIME Type LookupFind the MIME type for any file extension, or the extensions for a MIME type, in 400+ entries.Cron Expression GeneratorBuild crontab schedules visually, read them in plain English and see the next run times.URL Slug GeneratorTurn titles into clean, SEO-friendly URL slugs: accents, stop words, separators and bulk lines.JSON Schema GeneratorTurn sample JSON into a draft 2020-12 JSON Schema with types, required fields and formats.Gitignore GeneratorBuild a .gitignore from 50+ templates for languages, frameworks, IDEs and OS, merged and deduped.License GeneratorCreate a LICENSE file for MIT, Apache, GPL, BSD, ISC, MPL or Unlicense with your name and year.ULID GeneratorGenerate sortable ULIDs and UUID v7 in bulk, monotonic option, and decode their timestamps.Htpasswd GeneratorCreate .htpasswd entries with bcrypt, APR1-MD5 or SHA-1 for Apache and Nginx basic auth.Placeholder Image GeneratorCreate placeholder images in any size, color and text as PNG, JPG, WebP, SVG or data URI.Ads.txt GeneratorCreate or validate ads.txt and app-ads.txt files: seller lines, cert IDs and variables.Docker Run to Compose ConverterConvert docker run commands to docker-compose.yml, or a compose file back to docker run.Dockerfile GeneratorGenerate a production Dockerfile and .dockerignore for Node, Python, Go or a static nginx site.HTML Boilerplate GeneratorTick the options you need and get a clean HTML5 starter template with meta, OG tags and CSS reset.JSON to Zod SchemaInfer a Zod (or Yup) schema from sample JSON with optional, nullable and z.infer types.Linux Commands Cheat SheetSearchable Linux and bash command reference with flags explained, examples and copy buttons.LLMs.txt GeneratorBuild an llms.txt file for AI crawlers: summary and link sections, import from your sitemap.Nano ID GeneratorGenerate secure Nano IDs with custom alphabet, length and count, plus a collision calculator.Nginx Config GeneratorBuild an nginx server block: static site, SPA, reverse proxy or PHP, with SSL, gzip and redirects.OpenAPI / Swagger ViewerView OpenAPI 2/3 JSON or YAML as interactive API docs with validation and an endpoint list.package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.PKCE Code Challenge GeneratorGenerate an OAuth 2.0 PKCE code_verifier and S256 code_challenge, build auth URLs, verify pairs.README GeneratorFill in a form and get a polished README.md with badges, install, usage and license, live preview.Regex GeneratorBuild regular expressions visually from blocks or presets (email, date, phone) and test them live.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Database Schema DesignerDesign tables and relationships visually, then export SQL for MySQL, PostgreSQL or SQLite.Dummy File GeneratorCreate test files of an exact size in KB, MB or GB with zeros, random bytes or text.Kubernetes YAML GeneratorGenerate Deployment, Service, Ingress, ConfigMap, Secret and HPA manifests with safe defaults.Markdown TOC GeneratorGenerate a linked table of contents from Markdown headings with GitHub-style anchors.OpenAPI EditorEdit OpenAPI/Swagger YAML or JSON side by side with live API docs, validation and download.OpenAPI ValidatorValidate OpenAPI 3.0/3.1 and Swagger 2.0 specs: schema errors, broken $refs, line numbers.Pivot Table MakerBuild pivot tables from CSV or Excel by drag and drop: sum, count, average, charts, export.SQL Query BuilderBuild SELECT queries visually: joins, filters, GROUP BY, ORDER BY and LIMIT, as clean SQL.Truth Table GeneratorType a logic expression and get its full truth table, minterms and canonical DNF/CNF.TypeScript PlaygroundWrite TypeScript with live type checking, see the compiled JavaScript and run it in your browser.Article Schema GeneratorCreate Article, BlogPosting or NewsArticle JSON-LD with headline, authors, dates and images.Event Schema GeneratorCreate Event JSON-LD with dates, venue or online location, tickets, organizer and performers.Google Search Query BuilderBuild advanced Google searches with site:, filetype:, intitle:, exact phrases and date operators.HowTo Schema GeneratorCreate HowTo JSON-LD with steps, tools, supplies, total time and cost, then copy it.Htaccess GeneratorBuild an Apache .htaccess file: HTTPS, www, gzip, caching, error pages, IP blocks, hotlinks.HTML Email Template BuilderDrag and drop blocks to build a responsive, table-based HTML email with inline styles.Organization Schema GeneratorCreate Organization JSON-LD with logo, URL, contact points, address and social profiles.PIN GeneratorGenerate random 4, 6 or 8-digit PINs that avoid sequences, repeats, dates and common PINs.Product Schema GeneratorBuild Product JSON-LD with price, availability, brand, GTIN, ratings and reviews.Question Keyword GeneratorFind the questions people ask about a topic, grouped by who, what, why, how, can and more.Recipe Schema GeneratorCreate Recipe JSON-LD with ingredients, steps, prep and cook times, nutrition and ratings.Security Headers GeneratorPick HSTS, CSP, frame, referrer and permissions options and get Apache, Nginx, Netlify or Cloudflare config.SKU GeneratorBuild consistent SKUs from brand, category, size and color, then export every variant as CSV.Typography Scale GeneratorBuild a modular type scale from a base size and ratio, then copy CSS variables or a Tailwind config.WordPress Salt GeneratorGenerate fresh WordPress security keys and salts for wp-config.php, .env or Docker in one click.ANSI Color Code GeneratorStyle terminal text with 16, 256 or RGB colors and get escape codes for bash, Python, JS and C.Apache Virtual Host GeneratorCreate an Apache VirtualHost config with SSL, redirects, reverse proxy or PHP-FPM in seconds.Bash Prompt GeneratorDrag and drop a custom PS1 prompt for bash or zsh with colors, git branch and a live preview.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.cURL Command BuilderBuild curl commands from a form: method, headers, query, JSON or form body, auth and flags.Docker Compose to KubernetesConvert docker-compose.yml into Kubernetes Deployment, Service, ConfigMap and PVC manifests.Docker Compose ValidatorCheck a docker-compose.yml for YAML errors, schema mistakes, broken references and deprecated keys.
    See all 85 Code Generators & Builders →