GitLab CI/CD Specialist study materials
GitLab CI/CD Specialist study resources

GitLab CI/CD Specialist: Pipeline configuration and authoring

GitLab CI/CD Specialist · Work through your exam, one topic at a time.

All guide sections

Pipeline configuration and authoring

The Pipeline configuration and authoring domain tests whether you can turn repository intent into a valid, maintainable .gitlab-ci.yml: correct keyword placement, reusable includes and components, and pipeline-level controls. Expect questions on job structure, default, extends, !reference, include, and workflow:rules.

Core rules

  • A job is any top-level key that is not reserved. It needs script unless it is a trigger job or hidden template; hidden jobs start with . and never run.
  • stages defines order; jobs in the same stage run in parallel. .pre and .post are reserved stages.
  • default supplies job defaults such as image, services, cache, artifacts, before_script, after_script, retry, timeout, tags, and interruptible; it does not define job-specific script, stage, or rules.
  • extends performs reverse deep merge for hashes; arrays are replaced, not concatenated. Use !reference when you need to reuse a specific list or hash.
  • include can pull local, remote, template, project, or CI/CD component YAML. Components declare spec:inputs, and callers pass inputs.
  • workflow:rules decides whether a pipeline is created at all; job rules only decides whether a job is added.

Worked example

include:
  - component: gitlab.com/acme/ci/[email protected]
    inputs:
      target: production
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

The component supplies a pinned build template. The workflow rules create MR pipelines, suppress branch pipelines when an MR is already open, and otherwise allow branch pipelines. Without the middle rule, a push to a branch with an open MR can create duplicate pipelines.

Traps

Mixing rules with legacy only/except is invalid. Assuming include arrays concatenate is wrong; later definitions can replace values. A hidden job with no script is fine, but a visible job without script fails validation unless it is a trigger. default does not apply to workflow. Reserved names such as image or stages cannot be used as job names.