RousselTMLEARNING

Article · GitLab CI/CD: from discovery to expertise

Best practices and troubleshooting

1. Speeding up #

Feedback in under 10 minutes.

Levers #

Optimizations
  • Dependency cache keyed on the lock file (cache:key:files).
  • needs for an execution graph instead of strict stages; rules:changes to only run what is affected.
  • interruptible: true cancels pipelines superseded by a newer push (with the project option "auto-cancel redundant pipelines").
  • Lightweight images prebuilt with the job's tools; artifacts with expire_in.

2. Debugging #

Understanding why a job fails.

Frequent errors #

SymptomLikely cause
"This job is stuck"no runner with the right tags, or protected runner and unprotected branch
Pipeline created twicebranch and merge request pipelines: add workflow:rules
Empty variableprotected variable used on an unprotected branch
Artifact not foundproducer job missing from needs or expired artifact
docker: Cannot connect to the Docker daemonmissing dind service or wrong DOCKER_HOST/TLS

The CI_DEBUG_TRACE: "true" variable shows every executed command (careful: secrets may appear). gitlab-ci-local replays a pipeline on your machine without pushing.

3. Checklist #

Before rolling out.

Checks #

ItemCheck
Reliabilityprotected main branch, pipeline required before merge
Speedunder 10 minutes for merge request feedback
SecuritySAST and secret detection, OIDC rather than keys, runners separated by trust
Deliverysame image promoted, tracked environments, rollback tested
Reuseversioned components rather than copy-paste
Best practice : Treat .gitlab-ci.yml as code: review, tests (glab ci lint) and versioning of shared components.

Commands to know #

Commands to know
  • npx gitlab-ci-local test : run the test job locally
  • glab ci trace : follow the current job log
  • glab api projects/:id/pipelines?status=failed : failed pipelines

Sources #

Checked in November 2026: CI/CD platforms change every month, check versions and plans in the vendor's documentation.

📄 GitLab CI/CD best practices and troubleshooting →

My progress

  • ⏱ Estimated time : ≈ 3 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Reusing and securing GitLab pipelines

Industrializing GitLab CI/CD: extends, anchors and !reference, include, CI/CD components and cata...

GitHub Actions best practices and troubleshooting

Running GitHub Actions: speeding up and cutting costs, debugging (debug logs, act locally, gh run...

GitLab CI/CD: concepts and architecture

Discover GitLab CI/CD: the DevSecOps platform, the .gitlab-ci.yml file, pipelines, stages and job...

Writing a .gitlab-ci.yml: jobs, rules, cache and artifacts

Mastering .gitlab-ci.yml syntax: stages, jobs and images, rules and workflow, needs (DAG), cache ...

GitLab runners: types, executors, installation and security

Running GitLab jobs: instance, group and project runners, docker, kubernetes and docker-autoscale...

Building and delivering with GitLab: registry, environments and deployments

Delivering with GitLab CI/CD: building and publishing images to the project registry, package reg...

Operating Thanos: monitoring, performance, troubleshooting and alternatives

Thanos operating best practices: key metrics and alerts, mixin, caches, limits, frequent errors a...

End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice

Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...

Synthetic monitoring as code: industrializing synthetic scenario management

Learn how to integrate synthetic monitoring into your CI/CD pipelines for automated, resilient pe...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!