gitlab-ci-patterns

Build GitLab CI/CD pipelines with multi-stage workflows, caching, and security scanning.

3|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/firstsun-dev/skills --skill gitlab-ci-patterns-firstsun-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gitlab-ci-patterns
Source: https://github.com/firstsun-dev/skills/tree/main/custom/develop/gitlab-ci-patterns
Command: npx skills add https://github.com/firstsun-dev/skills --skill gitlab-ci-patterns-firstsun-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing GitLab CI/CD pipelines from scratch is error-prone and time-consuming, especially when configuring Docker builds, Terraform deployments, caching, and security scanning correctly. ## Core Features & Use Cases - Docker Build Patterns: Templates for building and pushing container images to the GitLab registry using docker-in-docker with commit-SHA tagging. - Terraform IaC Pipelines: Multi-stage validate, plan, and apply workflows with manual approval gates for production changes. - Security & Optimization: SAST, dependency scanning, container scanning with Trivy, caching strategies, and dynamic child pipelines. - Use Case: A team setting up CI/CD for a containerized service can apply the Docker template to build and push images, add Trivy scanning to catch vulnerabilities, and use caching to speed up repeated builds. ## Quick Start Ask the agent to create a GitLab CI pipeline that builds a Docker image, runs security scans, and deploys with Terraform using a manual approval step.

Frequently Asked Questions about gitlab-ci-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build and push Docker images in GitLab CI?

Use the docker:24 image with the docker:24-dind service, log in with CI_REGISTRY_USER and CI_REGISTRY_PASSWORD, then build and push tags based on CI_COMMIT_SHA. Setting DOCKER_DRIVER to overlay2 improves build performance.

How to set up a Terraform pipeline in GitLab CI?

Define validate, plan, and apply stages using the hashicorp/terraform image. Run terraform validate and fmt in the first stage, save the plan output as an artifact, and gate the apply job with when: manual restricted to the main branch.

Does GitLab CI support security scanning for containers?

Yes, GitLab provides built-in SAST, Dependency-Scanning, and Container-Scanning templates you can include directly. You can also add a Trivy job to scan images for HIGH and CRITICAL vulnerabilities with configurable failure behavior.

How do I cache dependencies between GitLab CI jobs?

Use the cache keyword with a key like CI_COMMIT_REF_SLUG and paths such as node_modules. The pull-push policy restores and updates the cache, while per-job cache keys isolate caches between different jobs.

What are dynamic child pipelines in GitLab CI?

Dynamic child pipelines let one job generate a YAML pipeline file at runtime and pass it as an artifact to a trigger job. The trigger job then launches the generated pipeline with strategy: depend, enabling flexible workflow generation.