# Tools Pipeline

> How the tools repo turns directories into Konflux components and ships images from build to release

---

LLMS index: [llms.txt](https://hummingbird-project.io/llms.txt) | Full content: [llms-full.txt](https://hummingbird-project.io/llms-full.txt)

---

The tools repository is a monorepo of Hummingbird services, shared
libraries, CLIs, and container images. Every container image it ships is a
Konflux component in the `tools` application: Pipelines as Code (PAC) builds
it from PipelineRuns in `.tekton/`, integration tests gate it, and a release
publishes it to `quay.io/hummingbird-ci`.

Most Lambda functions ship as ZIP packages instead, deployed through the
infrastructure repository's GitLab CI. Container-image Lambdas, such as the
container-catalog API, are Konflux components like any other image; their
images are mirrored from Quay to ECR at deploy time.

This page is the tools counterpart of the containers
[Image Pipeline][image-pipeline] and rpms [RPM Pipeline][rpm-pipeline] pages:
it follows a change from component authoring through build, testing, and
release, and documents the component system those stages rest on. The
[trigger manifests](https://hummingbird-project.io/docs/background/tools/trigger-manifests/) page covers the declarative
expectation files generated from the same component discovery.

[image-pipeline]: https://hummingbird-project.io/l/image-pipeline
[rpm-pipeline]: https://hummingbird-project.io/l/rpm-pipeline

## Overview

A change to a tool that ships a container image flows through these stages:

1. **Component authoring** — a `Containerfile` plus marker files define the
   component; the generator renders the PAC PipelineRuns and Konflux resources
2. **Build** — PAC builds each affected component on merge requests and on
   `main`, and Konflux records a Snapshot of the built image
3. **Testing** — the `tools-k8s-test` scenario runs K8s smoke tests against
   the MR Snapshot; Konflux commit statuses gate the merge
4. **Enterprise Contract validation** — the `tools-conforma` scenario
   validates the push Snapshot against the Enterprise Contract policy, gating
   the release
5. **Release** — the Integration Service creates the Release automatically;
   the release pipeline publishes the image to `quay.io/hummingbird-ci`

```mermaid
flowchart TD
    A["Component change<br/>Containerfile + markers"] --> B["Merge request"]
    B --> C["PAC build PipelineRun<br/>build pipeline resolved from the containers repo"]
    C --> D["MR Snapshot<br/>on-mr tag in the dev registry"]
    D --> E["tools-k8s-test<br/>K8s smoke tests in an EaaS namespace"]
    E --> F["Merge to main"]
    F --> G["Push build PipelineRun"]
    G --> H["Push Snapshot"]
    H --> I["tools-conforma<br/>Enterprise Contract validation"]
    I --> J["Automatic Release<br/>tools ReleasePlan"]
    J --> K["quay.io/hummingbird-ci/&lt;name&gt;:latest"]
```

Build output goes to the public development registry
`quay.io/redhat-user-workloads/hummingbird-tenant/<component>`; released images
are published to `quay.io/hummingbird-ci/<name>` with the `latest` tag.

## Stage 1: Component Authoring

Files in each directory, not central configuration, decide what the
directory is and how it builds. These marker files come in two kinds:

- **Discovery markers** say what a directory is: a Python project, a SAM
  stack, an image component.
- **Modifier markers** sit beside a `Containerfile` and change how that
  component builds.

### Marker files

The complete set of marker files:

| Marker           | Role      | Recognized by       | Effect            |
| ---------------- | --------- | ------------------- | ----------------- |
| `pyproject.toml` | discovery | Makefile            | Python project    |
| `template.yaml`  | discovery | Makefile            | SAM stack         |
| `Cargo.toml`     | discovery | Makefile            | Rust project      |
| `tests/*.mjs`    | discovery | Makefile            | node tests        |
| `Containerfile`  | discovery | component generator | image component   |
| `.build-context` | modifier  | component generator | build overrides   |
| `bib.yaml`       | modifier  | component generator | vm-build pipeline |

Two tools read the markers. The Makefile finds projects by wildcard, so
adding a project needs no Makefile edits:

```make
PYTHON_PROJECTS := $(patsubst %/pyproject.toml,%,$(wildcard */pyproject.toml))
SAM_PROJECTS := $(patsubst %/template.yaml,%,$(wildcard */template.yaml))
RUST_PROJECTS := $(patsubst %/Cargo.toml,%,$(wildcard */Cargo.toml))
NODE_TESTS := $(wildcard */tests/*.mjs)
```

The component generator walks the whole tree for `Containerfile`s
(`rglob("Containerfile")`) and reads the modifier markers from each
`Containerfile`'s directory.

[Makefile projects](#makefile-projects) covers the targets, SAM stacks, and
dependency handling for the Makefile-discovered project types.

### The component generator

The generator `ci/internal/render_template.py` turns every discovered
`Containerfile` into an image component and renders all generated files.
Components are named `<directory>--tools`; a `name:` override in
`.build-context` changes that (`hummingbird-sandbox/images/agent/` becomes
`hummingbird-agent-sandbox--tools`). The generated files:

- `.tekton/on-push.yaml` — PAC PipelineRuns for pushes to `main`
- `.tekton/on-pull-request.yaml` — PAC PipelineRuns for merge requests
- `.tekton/trigger-manifest-push.json` and
  `.tekton/trigger-manifest-pull-request.json` —
  [trigger manifests](https://hummingbird-project.io/docs/background/tools/trigger-manifests/)
- `konflux-templates/rendered.yml` — `Component`, `ImageRepository` (the
  public image repository in the development registry),
  `ReleasePlanAdmission`, and `IntegrationTestScenario` custom resources
- `.gitattributes` — marks the generated files for GitLab

Regenerate everything with:

```shell
make all
```

The `tree_status` CI job runs the generator on every MR and fails when
committed files drift from the generator output. Always run `make all` and
commit the regenerated files together with the change that caused them.

### Modifier markers

A component can carry either modifier marker, or both: `.build-context`
overrides the name, build context, dockerfile, and triggers of a component,
and `bib.yaml` switches the component to the vm-build pipeline, which honors
only the name and trigger overrides.

#### `.build-context`

An optional YAML file with these keys:

| Key              | Meaning                                                              | Default                                                                      |
| ---------------- | -------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `name`           | component and repository name; the component becomes `<name>--tools` | directory name                                                               |
| `context`        | build context passed to the build                                    | the `Containerfile` directory                                                |
| `dockerfile`     | path of the dockerfile inside the context                            | `Containerfile`, or `<directory>/Containerfile` when `context` is overridden |
| `extra_triggers` | trigger regexes appended to the component's triggers                 | `[]`                                                                         |
| `triggers`       | when non-empty, replaces the default `^<directory>/` trigger         | `[]`                                                                         |

A component rebuilds when anything under its `Containerfile` directory
changes. `extra_triggers` adds paths outside that directory, such as shared
libraries the image copies. A non-empty `triggers` list replaces the
directory trigger entirely, so co-located components can trigger precisely.

A `.build-context` must be a YAML mapping, and `triggers` and
`extra_triggers` must be lists of strings. A marker that breaks either rule
fails the generation: the generator names the component in an error and
exits non-zero, so `make all` and the `tree_status` CI job fail. The failure
has to come from the generator because `tree_status` only compares the
committed files with fresh output, so it cannot see a component missing from
both.

Example — `hummingbird-agent/.build-context`:

```yaml
context: "."
dockerfile: hummingbird-agent/Containerfile
extra_triggers:
  - "^hummingbird-ai/"
  - "^hummingbird-sandbox/"
```

The agent image builds from the repository root so its `Containerfile` can
copy the shared `hummingbird-ai` and `hummingbird-sandbox` packages, and the
extra triggers rebuild the image whenever those packages change.

#### `bib.yaml`

A `bib.yaml` beside the `Containerfile` selects the vm-build pipeline, which
converts the pinned source image to a qcow2 disk image with
bootc-image-builder and wraps it as a KubeVirt containerDisk. A vm-build
component differs from a standard one in three ways:

- it supports only the `name`, `triggers`, and `extra_triggers` overrides:
  the vm-build pipeline resolves `bib.yaml` and the `Containerfile` beside
  the discovery marker, so the generator ignores `context` and `dockerfile`
  with a warning
- it gets the built-in extra trigger `^\.tekton/vm-build-pipeline\.yaml`, so
  pipeline changes rebuild the disk
- it passes no build-args, because the vm-build pipeline does not accept
  them

`hummingbird-agent-vm-sandbox-disk/` is the current vm-build component: its
`bib.yaml` pins the source image
`quay.io/hummingbird-ci/hummingbird-agent-vm-sandbox` by digest, and Renovate
keeps that digest current. The disk rebuilds whenever the source image, the
pipeline, or the component's directory changes.

### Layout rules

Every `Containerfile` is a component, so a directory holds at most one
image. That gives two layouts:

- **One image** — the `Containerfile` sits directly in the component
  directory. Source packages often widen the build context with a
  `.build-context` so the image can copy shared packages; `hummingbird-agent`
  and `hummingbird-cve-agent` build from the repository root this way.
- **Several images** — each image gets its own `images/<name>/`
  subdirectory.

`hummingbird-sandbox/` is a Python package that ships two sandbox images
this way:

```text
hummingbird-sandbox/
├── hummingbird_sandbox/
├── pyproject.toml
├── tests/
└── images/
    ├── agent/
    │   ├── .build-context
    │   ├── Containerfile
    │   └── tests-k8s.yml
    └── cve/
        ├── .build-context
        ├── Containerfile
        └── tests-k8s.yml
```

Both `.build-context` files set `context: hummingbird-sandbox` and an explicit
`dockerfile: images/<name>/Containerfile`, so both images build from the
package directory. Their `name` overrides produce the components
`hummingbird-agent-sandbox--tools` and `hummingbird-cve-sandbox--tools`.

## Stage 2: Build

### Build triggers

Each generated PipelineRun carries a CEL expression that matches the event
type, the target branch, and the changed file paths against the component's
trigger regexes. A merge request or push to `main` fires one PipelineRun per
affected component; components whose triggers match nothing stay untouched.

The committed trigger manifests mirror the CEL expressions and additionally
list the integration test scenarios expected per event type. The
[workqueue service][workqueue] reads them to compute build and test
expectations for open MRs. The Hummingbird dashboard derives its trigger
expectations from its own rule set, which can drift from the manifests. See
the [trigger manifests](https://hummingbird-project.io/docs/background/tools/trigger-manifests/) page for the schema and
consumer semantics.

[workqueue]: https://hummingbird-project.io/l/workqueue-service

### Builds

PAC creates a build PipelineRun in the `hummingbird-tenant` namespace for
every affected component, running as the service account
`build-pipeline-<component>`:

- **Merge requests** build the image with the tag
  `on-mr-{{pull_request_number}}-{{revision}}` and set
  `image-expires-after: 5d`, so MR images are garbage-collected after five
  days.
- **Pushes to `main`** build the image with the `{{revision}}` tag.

Standard components resolve their build pipeline from the containers
repository with the Tekton git resolver: `.tekton/build-pipeline.yaml` at
`main` of `https://gitlab.com/redhat/hummingbird/containers.git`. It is the
same vendored Konflux `docker-build-oci-ta`-variant pipeline that builds the
containers repo's own images, so both repositories share one build-pipeline
definition. Every standard build:

- runs for `linux/arm64` and `linux/amd64`
- passes `privileged-nested: "true"` and the `COMMIT_SHA={{revision}}` build
  arg
- runs non-hermetic, so the Enterprise Contract policy excludes the
  hermetic check

vm-build components use this repository's own pipeline: their PipelineRuns
reference `vm-build` by name, and PAC resolves it from
`.tekton/vm-build-pipeline.yaml` at the event revision. bootc-image-builder
runs on `linux-root/amd64` remote builders, so vm-build is the only
single-platform pipeline, which is why the Enterprise Contract policy
excludes the platform check (see
[Stage 4](#stage-4-enterprise-contract-validation)).

Build output lands in the public development registry
`quay.io/redhat-user-workloads/hummingbird-tenant/<component>`. The
`ImageRepository` resources declare those repositories public, so
integration tests and Enterprise Contract validation pull Snapshot images
anonymously. Each successful build PipelineRun produces a Konflux Snapshot
of the built image.

### Konflux resources and deployment

Each image component is a `Component` in the `tools` application (namespace
`hummingbird-tenant`).

Child pipelines in the infrastructure repository deploy the Konflux
resources:

| Resource                                          | Source                                                                                    | Deployed by                                                                                                     |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `Component`, `ImageRepository`                    | `rendered.yml` at the pipeline commit                                                     | `tools-components` child pipeline: automatic `add_components_to_konflux`, manual `deploy_components_to_konflux` |
| `ReleasePlanAdmission`, `IntegrationTestScenario` | `rendered.yml` on `main`                                                                  | `tools-releases` sync on every merge                                                                            |
| `EnterpriseContractPolicy`                        | synthesized from the containers repo's `containers-rawhide` policy; not in `rendered.yml` | `tools-releases` sync on every merge                                                                            |

`add_components_to_konflux` runs when `konflux-templates/rendered.yml`
changes on an MR. It deploys only the components added relative to the MR's
base commit, so a new component can build before merge.

Admission and scenario resources deploy from `main` only. They are
repo-level configuration: deploying them from MR pipelines would let
concurrent MRs reset the live resources to stale versions.

The Application, ReleasePlans, and release service accounts and secrets live
in the infrastructure repository.

## Stage 3: Testing

### Integration test scenarios

The `tools` application runs an IntegrationTestScenario per concern, declared
in `konflux-templates/scenarios.yml` and rendered into
`konflux-templates/rendered.yml`:

| Scenario         | Context        | Gates                  | Purpose                                                      |
| ---------------- | -------------- | ---------------------- | ------------------------------------------------------------ |
| `tools-k8s-test` | `pull_request` | the merge              | K8s smoke tests against every MR Snapshot                    |
| `tools-conforma` | `component`    | the merge, the release | Enterprise Contract validation of single-component Snapshots |

`tools-k8s-test` runs the [K8s test pipeline][k8s-test-pipeline] as a
digest-pinned OCI bundle from `quay.io/hummingbird-ci/k8s-test-pipeline`;
Renovate keeps the digest current. Test failures report back to GitLab as
Konflux commit statuses. See [K8s testing](#k8s-testing) below for what the
tests do.

`tools-conforma` runs the upstream [enterprise-contract][ec-pipeline]
pipeline and validates Snapshots against the `tools` Enterprise Contract
policy. Its main role is gating the release: the Integration Service creates
the Release only after a push Snapshot passes every required scenario (see
[Stage 5](#stage-5-release)). The `component` context matches
single-component Snapshots of both merge-request and push events, so the
scenario reports on MRs as well.

Both scenarios:

- pass the Snapshot by name
  (`test.appstudio.openshift.io/snapshot-param-as-name`) instead of
  embedding the full Snapshot JSON into the test PipelineRuns
- report their outcome through the standardized `TEST_OUTPUT` result that
  the Integration Service aggregates

The K8s test pipeline also fails its own PipelineRun on test failure, so the
GitLab commit status turns red.

[k8s-test-pipeline]: https://hummingbird-project.io/l/k8s-test-pipeline-design
[ec-pipeline]: https://github.com/konflux-ci/build-definitions/blob/main/pipelines/enterprise-contract.yaml

### K8s testing

Container images can carry `tests-k8s.yml` smoke tests that verify the image
works in a real Kubernetes cluster. Each test creates short-lived pods, checks
expected behavior, and cleans up. The tests run automatically on every MR via
the `tools-k8s-test` scenario described in
[Integration test scenarios](#integration-test-scenarios).

#### Test runner

Tests are executed by [`ci/run_tests_k8s.sh`][run-tests-k8s]. For each component it:

1. Reads `{component}/tests-k8s.yml`
2. Parses each test entry (YAML → JSON via Python)
3. Runs the `command` block with `kubectl` wired to the target cluster
4. Cleans up labeled resources (`hum-k8s-test=<run-id>`) after each test

The [test format page][k8s-test-format] documents the environment variables
and shell helpers available to tests.

#### Running locally

Test against a local cluster (kind, minikube, or remote):

```bash
# Single component with a published image
IMAGE_URL=quay.io/hummingbird-ci/gitlab-ci:latest \
IMAGE_NAME=gitlab-ci--tools \
  ci/run_tests_k8s.sh --context kind-kind gitlab-ci--tools

# Single component with a locally-built image
podman build -t localhost/hummingbird-dashboard:dev hummingbird-dashboard/
kind load docker-image localhost/hummingbird-dashboard:dev
IMAGE_URL=localhost/hummingbird-dashboard:dev \
IMAGE_NAME=hummingbird-dashboard--tools \
  ci/run_tests_k8s.sh --context kind-kind hummingbird-dashboard--tools
```

#### CI integration

In Konflux, the [K8s test pipeline][k8s-test-pipeline] runs on every MR
Snapshot:

1. Checks whether `tests-k8s.yml` exists for the changed component
2. Provisions an ephemeral
   [EaaS namespace](https://hummingbird-project.io/l/k8s-test-eaas)
3. Runs `ci/run_tests_k8s.sh` with the built image

Components without `tests-k8s.yml` skip the test: the pipeline exits right
after the check step.

When an MR touches two or more components of the same application, Konflux
runs the pipeline in two shapes:

| Run           | Created for                                                                      | Script input                                                                                    |
| ------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| Per-component | each component Snapshot                                                          | the single-component `IMAGE_URL`/`IMAGE_NAME` pair                                              |
| Group         | the group Snapshot, after every per-component build in the application completes | one invocation with `--group-component-name` repeated and `IMAGE_URL_<COMPONENT>` per component |

The script handles `--group-component-name` identically to
`--component-name`. Konflux creates a group Snapshot only when at least two
components of the same application are on the same source branch, so an MR
touching a single component gets no group run.

The workqueue service tracks these test PipelineRuns per scenario; see
[DDR-53](https://hummingbird-project.io/docs/background/tools/workqueue-service/design-decisions/executors/#ddr-53-scenario-keyed-test-plr-tracking-in-the-unified-needs_plr-dimension)
for how they fit its `needs_plr` / `needs_expected_plrs` dimensions.

#### Adding tests for a new component

1. Create `{component}/tests-k8s.yml` with one or more named tests:

   ```yaml
   ---
   smoke-test:
     command: |
       name="${TEST_GROUP}-smoke-${TEST_RUN_ID}"
       kubectl run "${name}" --image="${TEST_IMAGE:?}" --restart=Never \
         --labels="${TEST_RUN_LABEL}" \
         --command -- echo "hello"
       kubectl wait --for=jsonpath='{.status.phase}'=Succeeded \
         "pod/${name}" --timeout=120s || test_fail "Pod did not succeed"
       kubectl logs "${name}"
   ```

2. Use `${TEST_IMAGE}` for the image under test, `${TEST_RUN_ID}` and
   `${TEST_RUN_LABEL}` for unique naming and cleanup.

3. Call `test_fail "message"` to fail a test with a clear message.

4. Keep tests fast (under 2 minutes) — these are smoke tests, not
   integration suites.

##### Common pitfalls

- All lines in `command: |` block scalars must be indented relative to the
  `command` key. Unindented lines break YAML parsing.
- Use `command -v` instead of `which` to check for commands — `which` is not
  available in all container images.
- For multi-statement Python one-liners, use semicolons on a single line:
  `python3 -c 'import foo; import bar; print("ok")'`

#### Debugging failures

See the [EaaS and Debugging](https://hummingbird-project.io/l/k8s-test-eaas)
guide for accessing ephemeral namespaces and using KubeArchive for historical
PipelineRun data.

[run-tests-k8s]: https://gitlab.com/redhat/hummingbird/tools/-/blob/main/ci/run_tests_k8s.sh
[k8s-test-format]: https://hummingbird-project.io/l/k8s-test-format

## Stage 4: Enterprise Contract Validation

Before release, images must pass [Enterprise Contract][ec] (Conforma)
validation against the `tools` policy. The infrastructure `tools-releases`
sync synthesizes that policy from the containers repo's `containers-rawhide`
policy, so it inherits all of that policy's exclusions, among them the Snyk
checks, certification preflight, label requirements, and the weekday release
restriction (see the [containers policy macro][containers-policy]).

On top of those, the `tools` policy excludes:

| Excluded rule                       | Why                                                                     |
| ----------------------------------- | ----------------------------------------------------------------------- |
| `hermetic_task.hermetic`            | tools builds run non-hermetic                                           |
| `buildah_build_task.platform_param` | the vm-build pipeline builds disk images on `linux-root/amd64` builders |
| `schedule.date_restriction`         | releases can ship during Red Hat's internal recharge periods            |

Because tools images build from Hummingbird base images, the allowed
base-image registry prefixes add `quay.io/hummingbird-ci/`,
`quay.io/hummingbird/`, `quay.io/hummingbird-community/`, and
`registry.access.redhat.com/hi/` to the Rawhide defaults.

The policy is enforced twice: `tools-conforma` validates each Snapshot
(merge-request and push), and the release pipeline re-validates it inside
`verify-conforma` with the release intention before anything is published.

[ec]: https://enterprisecontract.dev/
[containers-policy]: https://gitlab.com/redhat/hummingbird/containers/-/blob/main/konflux-templates/macros/policy.yml.j2

## Stage 5: Release

Two ReleasePlans in the infrastructure repository pair with two
ReleasePlanAdmissions rendered into `konflux-templates/rendered.yml`:

| ReleasePlan         | ReleasePlanAdmission | Trigger                          | Releases                        |
| ------------------- | -------------------- | -------------------------------- | ------------------------------- |
| `tools`             | `tools-single`       | automatic (`auto-release` label) | single-component Snapshots      |
| `tools-manual-full` | `tools-full`         | manual                           | every component in one Snapshot |

Once a push Snapshot passes every required integration test, the
Integration Service creates the `tools` Release automatically; nothing
manual sits between merge and publication.

The `tools-single` admission maps each component to
`quay.io/hummingbird-ci/<name>` with the `latest` tag and pushes the source
container alongside the image. It runs the managed
[push-to-external-registry][release-catalog] pipeline from the
release-service-catalog as the `hummingbird-ci-release` service account,
under the `tools` policy. The pipeline:

1. verifies Conforma again
2. copies the image and its source container with cosign to the
   destination registry
3. makes the destination repository public with the registry
   administration token

The release service stamps each Release with a two-day expiration window
(`releaseGracePeriodDays: 2`); KubeArchive removes expired Releases, and a
Snapshot is protected from garbage collection while its Release exists.

Failures are handled automatically:

- **Failed releases** — the Hummingbird dashboard's `auto-rerun` CronJob
  (every ten minutes) clones the failed Release into a retry that reuses the
  same Snapshot and ReleasePlan, with no rebuild.
- **Failed push builds** — the `push-rerun` CronJob (every five minutes)
  clones the failed build PipelineRun into a fresh run.
- **Notification** — a `finalPipeline` posts a Slack notification when a
  release fails, pointing maintainers at the failure.

Downstream, the infrastructure repository pins released images by digest in
its `vars.d/*.yml` files, kept current by its own Renovate. Kubernetes
services deploy those images, and container-image Lambdas mirror them from
Quay to ECR at deploy time.

[release-catalog]: https://github.com/konflux-ci/release-service-catalog

## Renovate

[Renovate][renovate] runs as an hourly CronJob in the infrastructure
repository against this repository, with automerge enabled. The repo-local
`renovate.json` configures what it manages:

| Item                   | What Renovate does                                                                                                                                                                      |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Konflux bundle digests | follows `quay.io/hummingbird-ci/k8s-test-pipeline:latest` in the scenario templates and `rendered.yml`, so `tools-k8s-test` tracks the released pipeline                                |
| Containerfile versions | bumps `ARG` variables annotated with `renovate:` comments to new upstream releases                                                                                                      |
| `bib.yaml` digests     | tracks the released source images behind the vm-build components                                                                                                                        |
| Language dependencies  | opens grouped MRs (for example one for all Python dependencies) for npm, cargo, pip, and Go, with a minimum release age as a supply-chain safety margin and weekly lockfile maintenance |
| SAM lockfiles          | regenerates `requirements.txt` from `requirements.in` with pip-compile (see [Makefile projects](#makefile-projects))                                                                    |

Renovate's merge requests go through the same gating as any other change:
the PAC builds and integration test scenarios report Konflux commit
statuses that gate the merge.

Every component releases under a single rolling `latest` tag, so consumers
inside and outside the repository pin `quay.io/hummingbird-ci/<name>` by
digest and let Renovate follow the tag. The `tools-k8s-test` scenario and
the k8s-test pipeline's own image references work the same way.

[renovate]: https://docs.renovatebot.com/

## Makefile projects

The Makefile discovers Python, SAM, Rust, and Node test projects from their
[marker files](#marker-files) and gives each type its own targets.

### Targets per project type

| Type       | Discovered targets                                                                                                                 |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Python     | auto-included in `check`, `test`, `coverage`, `fmt`; gets `<project>/setup`                                                        |
| SAM stack  | `sam-validate` plus `<project>/sam-build`, `<project>/sam-deploy`, `<project>/sam-redeploy` (podman-based)                         |
| Rust       | covered by `rust-check`, `rust-test`, `rust-fmt` (podman-based)                                                                    |
| Node tests | run as part of `make test`                                                                                                         |
| Go         | not discovered; `rpm-cve-count`, `hummingbird-osv-generator`, and `upstream-monitor` each have a dedicated job in `.gitlab-ci.yml` |

The top-level targets are the user-facing entry points:

| Target         | Runs                                                                   |
| -------------- | ---------------------------------------------------------------------- |
| `check`        | the Python checks, `rust-check`, the frontmatter and IAM-policy checks |
| `test`         | the Python and Node tests, `rust-test`                                 |
| `fmt`          | the Python and Rust formatters                                         |
| `sam-validate` | SAM template validation                                                |
| `markdownlint` | documentation linting                                                  |

The Rust, SAM, and markdownlint steps run in podman; the Python and Node
steps run natively. The `*-host` target variants are CI-only, for
environments without nested podman.

### SAM stacks

A `template.yaml` defines AWS infrastructure with SAM/CloudFormation. Stacks
come in three shapes:

- **Multi-function stacks** — container-catalog
- **Single-function ZIP Lambdas** — the event forwarders, mr-auto-approver,
  and similar
- **Function-less stacks** — hummingbird-status, hummingbird-agent,
  hummingbird-tools, workqueue-service, service-metrics, s3-lookaside-cache

Function-less stacks hold only the supporting AWS resources for services
that run in Kubernetes on tools-built images: SQS queues and queue policies,
SNS subscriptions, S3 buckets and policies, and IAM users and policies.

The per-project SAM targets run in podman with `~/.aws` mounted for
credentials.

### Dependencies

Where each kind of project declares its dependencies:

| Kind                             | Dependencies                                                    |
| -------------------------------- | --------------------------------------------------------------- |
| ZIP Lambda                       | hash-locked `requirements.txt`, compiled from `requirements.in` |
| Container-image Lambda           | the tool directory's `Containerfile`; no `requirements.txt`     |
| Container image with Python deps | a pip-compile lockfile next to the `Containerfile`              |
| Python tool or library           | `pyproject.toml`                                                |

ZIP Lambdas keep semantic ranges in `requirements.in`; `sam build` installs
the committed, hash-locked `requirements.txt`, so deploys are reproducible.
`kubernetes-event-forwarder` is the exception: it compiles its lockfile from
its own `pyproject.toml`.

Each lockfile header records the `uv pip compile` command that produced it.
Renovate's pip-compile manager re-runs that command to regenerate the
lockfile, with hash pinning and a rolling 7-day resolver cooldown, so a
version published mid-deploy or mid-run cannot change what ships. The
`validate-lockfiles` CI job (`ci/internal/validate_lockfiles.sh`) enforces
the header convention on every `requirements.in`/`requirements.txt` pair.

Image lockfiles follow the same pattern: `hummingbird-agent/Containerfile`
installs `hummingbird-agent/requirements.txt`, compiled from the project's
`pyproject.toml`, and `workqueue-service`'s image consumes its SAM project's
lockfile. Container-image Lambdas, such as the container-catalog API, build
as Konflux components ([Stage 5](#stage-5-release) covers the deploy-time
Quay-to-ECR mirror).

## Adding a new tool

1. Create the tool directory `<tool-name>/`.
2. Add the project files for its type:
   - **Python tool** — a `<tool_name>/` package (kebab-case directory,
     snake_case package), `pyproject.toml`, and unit tests under `tests/`
   - **ZIP SAM Lambda** — `template.yaml`, `requirements.in` with the
     semantic ranges, and the hash-locked `requirements.txt` compiled from
     it (see [Dependencies](#dependencies))
   - **Container-image SAM Lambda** — `template.yaml` plus the
     `Containerfile` from step 5
   - **Rust tool** — `Cargo.toml`
3. Add the tool to the projects table in `README.md` with a link to its docs
   page.
4. Create `documentation/components/<tool-name>.md`.
5. Ship a container image by adding a `Containerfile` (plus modifier markers
   as needed), then run `make all` and commit the regenerated files. Add a
   `tests-k8s.yml` next to the `Containerfile` to get K8s smoke tests on MRs
   (see [adding tests for a new component](#adding-tests-for-a-new-component)).

The Makefile picks the project up automatically, and new components deploy
from the MR via `add_components_to_konflux`.

## References

- [Image Pipeline][image-pipeline] — the containers equivalent of this page
- [RPM Pipeline][rpm-pipeline] — the rpms equivalent of this page
- [Trigger Manifests](https://hummingbird-project.io/docs/background/tools/trigger-manifests/) — declarative build and test
  expectations generated from the same component discovery
- [Konflux integration tests][konflux-integration] — IntegrationTestScenario
  concepts, contexts, and standardized outputs
- [Konflux group snapshots][group-snapshots] — how group Snapshots form when
  multiple components change
- [K8s test pipeline][k8s-test-pipeline] — the pipeline behind
  `tools-k8s-test`
- [EaaS and Debugging][k8s-test-eaas] — ephemeral namespaces and PipelineRun
  history for test debugging
- [K8s testing](#k8s-testing) — the testing section on this page

[konflux-integration]: https://konflux-ci.dev/docs/testing/integration/
[group-snapshots]: https://konflux-ci.dev/docs/testing/integration/snapshots/group-snapshots/
[k8s-test-eaas]: https://hummingbird-project.io/l/k8s-test-eaas
