Search for a command to run...
Configure GitLab CI/CD pipelines with GitLab 19, install and register GitLab Runner 19.5 with the new authentication tokens, and build secure multi-stage pipelines.
GitLab CI/CD is built into every GitLab project. You describe your pipeline in a
.gitlab-ci.yml file, and GitLab Runner executes the jobs on a machine you control.
GitLab 19.x (GitLab.com and Self-Managed) · GitLab Runner 19.5.0 ·
runner authentication tokens (glrt-) · rules: instead of only: / except:
The legacy runner registration token (--registration-token) and the registration
workflow it belongs to are deprecated and scheduled for removal in GitLab 20.0.
Create the runner first, copy its glrt- authentication token, and register with
--token. This guide uses the new method throughout.
.gitlab-ci.yml file in the project root| Keyword | Purpose |
|---|---|
stages | The phases of your pipeline — jobs in a later stage wait for the earlier ones |
jobs | The units of work; each runs a script in a container |
rules | Decides whether a job runs, based on the branch, tags and pipeline source |
needs | Builds a dependency graph so jobs can start as soon as their dependencies finish |
include | Reuses configuration from other files or projects |
workflow | Rules that decide whether a pipeline is created at all |
Create .gitlab-ci.yml in your project root:
stages:
- build
- test
default:
image: node:24
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
build:
stage: build
script:
- npm ci
- npm run build --if-present
artifacts:
paths:
- dist/
expire_in: 1 week
test:
stage: test
script:
- npm ci
- npm test
coverage: '/Coverage: \d+\.\d+/'Push it and open CI/CD → Pipelines to watch the run.
Shared runners are provided by GitLab and are enabled per project under Settings → CI/CD → Runners.
# No tags required — any shared runner can pick the job up
test:
stage: test
script:
- npm testShared runners are free for public projects. Private projects get a monthly minute allowance that depends on the plan.
variables:
STAGING_API: "https://api.staging.example.com"
PROD_API: "https://api.example.com"
deploy_staging:
script:
- curl -H "Authorization: Bearer $DEPLOY_TOKEN" "$STAGING_API/deploy"
environment:
name: staging| Scope | Where to define it |
|---|---|
| Project | Settings → CI/CD → Variables |
| Group | Group → Settings → CI/CD → Variables |
| Instance | Admin Area → CI/CD → Variables |
Tick Masked so the value is hidden in job logs, and Protected so it is only exposed to pipelines running on protected branches or tags.
Instead of storing a long-lived cloud key, let GitLab mint a short-lived token:
deploy:
id_tokens:
AWS_ID_TOKEN:
aud: https://gitlab.com
script:
- aws configure export-credentials --profile oidc --web-identity-token "$AWS_ID_TOKEN" ...cache:
key:
files:
- package-lock.json
paths:
- node_modules/
- .npm/
artifacts:
paths:
- dist/
reports:
coverage: coverage/lcov.info
junit: junit.xml
expire_in: 1 weekcache speeds up the next job in the same pipeline. It is not uploaded as an
artifact and is not visible in the UI.artifacts are uploaded, downloadable from the job page, and passed to later stages
through needs..gitlab-ci.yml is reviewed like code.rules: instead of only: / except:.latest.needs to parallelise independent jobs and keep the pipeline fast.resource_group for jobs that deploy to the same environment, so they cannot
run concurrently.expire_in so the runner disk does not fill up.include away.Set up GitHub Actions with the current action versions, run your first workflow, configure GitHub-hosted and self-hosted runners and secure your pipelines with OIDC.
Install Jenkins 2.580 LTS on Linux, Windows, macOS, Docker and Kubernetes, configure it with Configuration as Code, add agents and build your first pipeline.