Skip to main content

Build your own components catalog

This article describes an introduction into building components catalogs.

There are 3 components available in the xrow-public/ci-tools that can be used as a reference for building your own components catalog:

  • pipelines-components: A component to build a catalog of components. It is used to build a versioned catalog of components in this repository.
  • trigger-pipeline: A component to trigger a downstream pipeline and wait for the result. It is used in the test pipelines of this repository.
  • test-component: A component to test the functionality of the trigger-pipeline component. It is used in the test pipelines of this repository.

See the test project for reference.

Project and pipeline structure​

docs/ <-- Markdown files are stored in the documentation folder>
└── index.md
container/ <-- build file for container images are stored in the container folder>
└── ubi10
├── Containerfile
templates/ <-- components are stored in the templates folder>
└── my-component
├── templates.yml
├── docs.md
├── test.yml
.gitlab-ci.yml <-- pipeline file to build and test the component>

Pipeline overview​

Pipeline overview

Build and use a custom pipeline image​

Build a custom image when a component needs tools that are not available in the standard CI Tools images. The following example builds an image from container/component-tools/Containerfile and uses the immutable commit tag in a later job of the same pipeline.

Create container/component-tools/Containerfile:

FROM registry.access.redhat.com/ubi10/ubi-minimal:10.1
RUN microdnf install -y git-core jq \
&& microdnf clean all

Add the build component and the consuming job to .gitlab-ci.yml:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/container@stable
inputs:
name: component-tools
path: container/component-tools
scanning-enabled: false

test:component-tools:
stage: test
image: "$CI_REGISTRY_IMAGE/component-tools:$CI_COMMIT_SHA"
needs:
- job: build:component-tools
script:
- git --version
- jq --version

The container component pushes $CI_REGISTRY_IMAGE/component-tools:$CI_COMMIT_SHA before test:component-tools starts. The needs entry prevents the runner from trying to pull the image before the build finishes.

Authenticate to a protected group registry​

Follow the central registry authentication guide to configure private job images for a shared group. Supply credentials before Runner starts and ensure the pipeline ref can access them.

Nesting components in new components​

Example for a new Node.js component:

spec:
inputs:
name:
default: myapplication
image:
default: registry.access.redhat.com/hi/nodejs:26.9.0-builder-1789612397@sha256:614e489f0e686023b082bb11acbf53072a86fbab41475dfea0138951ec90bb1f
---

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/s2i@stable
inputs:
name: $[[ inputs.name ]]
type: nodejs
image: $[[ inputs.image ]]

# Continue with custom code