Chapter 13Lesson 03~155 minutes

CI/CD Components, Component Catalog, inputs, Versioned Reuse, and Organization-Wide Pipeline Building Blocks: Configuration, Design Choices, and Tradeoffs

Organization-wide reuse creates leverage only when ownership, versioning, contracts, permissions, and upgrade policy are explicit. This lesson compares components with raw includes and turns SemVer, pinning, central golden paths, team autonomy, dependency minimization, and compatibility evidence into deliberate design choices.

CI/CD componentsspec:inputsComponent CatalogVersioned reusePipeline APIs

Learning objectives

  • Choose component versus raw include based on interface stability, discoverability, versioning, ownership, and caller freedom.
  • Balance centralized golden paths with team autonomy by minimizing hidden assumptions and exposing only necessary inputs.
  • Design SemVer and pinning policies that separate immutable evidence from convenience update channels.
  • Minimize component permissions, global-keyword effects, external dependencies, and secret assumptions.
  • Use a decision table to justify reuse architecture with tier/offering, trust, rollback, cost, and compatibility evidence.

1. Component architecture is organizational API design

A shared component changes many teams at once. The design target is not maximum abstraction; it is a small, reviewable interface that removes repeated engineering while keeping caller state and trust explicit. Every hidden assumption becomes future coupling.

2. Component versus raw include

Choice Prefer when Tradeoff
Raw local/project include Same team/repository; low distribution need; simple shared YAML Fast and transparent, but weaker product/interface/version-discovery model
CI/CD component Reusable organization/team building block with explicit inputs and release lifecycle More contract/testing/version discipline; better distribution; requires component project ownership
Catalog-published component Broad discoverability and governed releases matter Adds publication/release process; consumers still audit trust and pinning

3. Flexible inputs versus a stable contract

Do not turn every internal knob into an input. Inputs are part of the public API. Expose choices the caller legitimately owns: stage, job prefix/name, feature mode, report path, or bounded policy options. Keep implementation details internal so maintainers can refactor safely.

Use types/options/regex/defaults to narrow invalid states. Document whether each input affects job naming, execution image, permissions, artifact paths, external side effects, or security posture.

4. Centralized golden path versus team autonomy

A platform team can standardize tests, packaging, provenance, or deployment patterns through components, but forcing a component to own every stage and global keyword creates conflict with consumer pipelines. GitLab’s component guidance recommends avoiding global keywords and hard-coded assumptions where practical.

A golden path should be easy to adopt, explicit about side effects, and escapable through governed exceptions rather than by hidden variable hacks.

5. Encode release compatibility with SemVer and pinning

Use semantic versions as promises, not decoration. Patch releases fix defects without changing documented behavior. Minor releases add compatible capabilities. Major releases can break callers and require migration guidance. Exact release tags or SHAs maximize reproducibility; partial selectors trade some reproducibility for bounded automatic updates.

Selector policy Benefit Risk/control
Full SHA Exact immutable source Harder human upgrade tracking; pair with release metadata
Exact 1.4.2 Readable governed release Manual updates required
1.4 Automatic compatible patch adoption Moving within minor line; test consumers
1 Automatic compatible minor+patch adoption Larger change window; stronger compatibility tests required
~latest Fastest adoption Can cross major versions; unsuitable as default production policy

6. Least privilege belongs in the component contract

A component should not assume caller secrets exist or that every job may reach production networks. Document each required identity, token scope, environment, runner tag, protected ref, API permission, and external target. Prefer GitLab-native narrow identities such as CI_JOB_TOKEN where supported and OIDC for supported external federation rather than long-lived broad credentials.

Never define “works if you give it Owner PAT” as the component’s interface.

7. Minimize dependencies and pin executable dependencies

Components can depend on images, tools, includes, or even other components. Each dependency expands the trust graph. GitLab recommends keeping component dependencies minimal and pinning cross-project component dependencies to released versions rather than moving references.

If a component ships a tool image, version that image coherently with the component and verify its digest where practical. Do not let a stable component tag silently pull an unreviewed mutable tool image.

8. Compatibility testing is evidence, not optimism

A component project should test the component itself using its current SHA, then test representative valid inputs, invalid inputs, generated job names, artifacts/reports, and any external integrations. Before a release, compare the expanded consumer configuration against the documented contract.

Contract surface Test evidence
Input validation Required/type/options/regex accepted and rejected cases
Job identity No collision; caller-controlled prefix/name behaves as documented
Runtime Supported runner/executor/image/toolchain recorded
Outputs Artifact/report paths, digests, retention, and sensitivity
Security No implicit secret logging; minimum token/runner/network requirements
Upgrade Previous supported invocation still compiles/runs or migration is documented

9. Catalog and analytics are governance aids, not mandatory runtime dependencies

The Catalog provides discovery and released-version resolution. Current GitLab also exposes usage analytics, with some detailed usage views tier-dependent and recently introduced. Treat those as governance signals: they can help find outdated consumers, but they do not replace consumer-owned dependency inventories or release communications.

10. Worked scenario: organization-wide test policy component

A platform team wants a reusable unit-test component for 80 repositories. The component should accept a job prefix, stage, runtime image reference, and report path, but should not receive production secrets or own deployment stages. The team publishes exact releases and recommends @1 only after backward-compatibility tests are reliable; critical repositories pin exact releases or SHAs.

Decision Choice Why
Reuse form Component Stable shared API/distribution needed across many projects
Version default Exact release 1.3.4 for critical repos Reviewable upgrade and easy rollback
Job naming Required prefix input Avoid collisions and allow multiple instances
Secrets None required Unit-test component should not inherit deployment authority
Outputs JUnit report + optional raw log artifact Typed feedback plus inspectable evidence
Rollback Previous exact release No rebuild of component behavior during incident

11. Decision checklist

  • Who owns and reviews the component source?
  • What exactly is public API: inputs, generated jobs, artifacts, side effects, identities?
  • Which references are allowed in production consumers?
  • How is backward compatibility tested and communicated?
  • What is the rollback version and how long are old majors supported?
  • Which features are Free versus tier/admin dependent?
  • Can the component run safely on untrusted MR/fork code?

Knowledge check

Why is exposing every internal variable as an input a poor component design?

When is @1 a reasonable selector?

Why should a testing component avoid production deployment credentials even if many consumers have them?

What is the rollback unit for a component change?

Does catalog usage analytics prove a component is secure?

Next lesson

Diagnostics, failure modes, security, and performance

Diagnose component contract, version, permission, collision, provenance, and side-effect failures from preserved evidence.

Version and compatibility note

GitLab and GitLab Runner evolve continuously. Treat version-sensitive YAML, runner/executor behavior, APIs, security features, policy controls, tiers, and deprecations as assumptions to verify against the current official GitLab documentation before production use. Preserve the exact project/ref/SHA, compiled configuration, pipeline/job IDs, runner/tool versions, and external target evidence used for any reproducible lab or incident record.

Official references and version notes

Documentation verification date: 2026-09-11. Component, input, catalog, component-context, analytics, and publication behavior is version-sensitive. Re-check the GitLab version deployed on Self-Managed or Dedicated instances before relying on newer syntax.

  • CI/CD components and CI/CD Catalog — component projects, version selectors, permissions, testing, publication, security guidance, and current project limits.
  • CI/CD inputs — spec:inputs, interpolation, types, defaults, options, regex validation, size limits, and include inputs.
  • CI/CD YAML syntax reference — include:component, include:inputs, component context, and current parsing semantics.
  • Pipeline editor — validate and inspect expanded configuration before execution.
  • CI Lint — syntax/configuration validation and pipeline simulation where available.
  • Component examples — testing components against the current SHA and coupling versioned resources to component releases.
Current behavior used by this chapter: CI/CD components and the Catalog are available on Free/Premium/Ultimate and GitLab.com/Self-Managed/Dedicated. A component project can currently contain up to 100 components. A component reference can use a commit SHA, tag, or branch; catalog-published components additionally support partial SemVer selectors such as 1/1.2 and ~latest. Catalog releases require SemVer and publication through a GitLab release job. Components can only be referenced from the same GitLab instance. Inputs are resolved at pipeline creation; missing required or invalid typed/options/regex values reject configuration before runner execution. A string inside one input must be under 1 KB, and a string containing interpolated input content must be under 1 MB. Component context fields (name, sha, version, reference) are current functionality but should be version-checked on older instances.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.