Endpoints, toggles, configuration, and metrics#

Facts and specifications for the SKA CI/CD Artefact Validations service: HTTP endpoints, feature toggles, configuration schema, environment variables, metrics, labels, checks, retry policies, the audit record, and the cleanup script. For concepts and design rationale, see How the Artefact Validations service works; for operational guides, see Run and operate the Artefact Validations.

HTTP endpoints#

The FastAPI receiver (main_api.py) exposes four routes. Webhook routes authenticate the request, validate the payload against a Pydantic model, and on success enqueue a Celery task and return 200 OK. An invalid payload returns 400; a failed authentication returns 401; a malformed request returns 422.

Path

Method

Trigger

Task / behaviour

/nexus

POST

Nexus component webhook. Only the CREATED action is accepted.

main_task(body, "nexus")

/harbor

POST

Harbor PUSH_ARTIFACT (artifact pushed). Other event types, and tags starting with sha256, are rejected.

main_task(body, "harbor")

/harbor/sbom_sign

POST

Harbor SCANNING_COMPLETED (scan finished) with event_data.scan.scan_type set to sbom. The vulnerability scan’s copy of the event is rejected.

sbom_sign_task(body)

/metrics

GET

Prometheus scrape.

Serves metrics when the metrics toggle is on; otherwise 404.

Endpoint authentication#

Authentication is configured per source in api/auth_config.yaml:

Endpoint(s)

Method

Details

/harbor, /harbor/sbom_sign

token

The authorization header must equal HARBOR_TOKEN.

/nexus

hmac_signature

HMAC-SHA1 of the raw body keyed with NEXUS_HMAC_SIGNATURE_SECRET, sent in the X-Nexus-Webhook-Signature header.

Feature toggles#

Toggles are evaluated through the Unleash Proxy and managed in the GitLab project under Deploy > Feature flags. Unless noted, the fallback when Unleash is unreachable is shown in the “Fallback” column.

Toggle

Effect

Fallback

metrics

Enables metric recording and the /metrics endpoint. When off, counters/summaries are not updated and /metrics returns 404.

off

check-critical-vulnerabilities

When on, a vulnerability report at or above vulnerability_severity blocks Harbor promotion. When off, vulnerabilities never block promotion.

off

sign-sbom

When on, /harbor/sbom_sign signs the artefact’s SBOM. When off, the task is a no-op.

off

require-signatures

When on, Harbor promotion additionally requires a signed image and a signed SBOM (see How the Artefact Validations service works). When off, the signature gate is skipped.

off

check-component-name

Enables the artefact-name check (CheckArtefactName).

off

check-component-tag

Enables the artefact-tag check (CheckArtefactTag).

off

check-component-manifest

Enables the metadata check (CheckArtefactMetadata).

off

check-raw-artefact-asset

Enables the raw-asset check (CheckRawArtefactAsset).

off

<check-toggle>-excluded

Per-artefact exclusion. When enabled for a given artefact name (passed as the Unleash userId), that check is skipped for that artefact.

excluded (the check is skipped)

Note

A check runs only when its own toggle is enabled. The toggle is evaluated twice: first to build the run list (run_checks, fallback off), then again inside perform_check (fallback on). Because the run-list evaluation happens first and decides membership, the effective fallback is off — checks do not run while Unleash is unreachable. The <check-toggle>-excluded lookup falls back to excluded (fallback on), so an artefact is skipped when its exclusion state cannot be resolved. The metrics toggle also gates metric writes through the check_metrics_toggle decorator.

Configuration file#

The behavioural configuration is a YAML file (mounted at /etc/config/config.yml; override with CONFIG_PATH). Each top-level key maps to a Pydantic config class.

Harbor configuration (HarborConfig, key harbor)#

Field

Purpose

Default

promotion_repository

Target Harbor project for promotion. The chart’s values.yaml ships test-promotion; set it to production for a real deployment.

production

query_retries

Attempts to fetch the vulnerability report before treating the artefact as vulnerable.

5

query_retry_delay_s

Delay in seconds between vulnerability-report attempts.

30

signature_check_retries

How many times the signature gate re-checks the artefact’s accessories while waiting for signatures to appear (in-handler poll).

5

signature_check_retry_delay_s

Delay in seconds between signature checks.

30

verify_sbom_signature

Whether the gate requires the SBOM to be signed. When false (the default) the SBOM must still exist, but its signature is not checked (a warning is logged) — this matches the current flow, in which the SBOM is signed only after promotion.

false

vulnerability_severity

Minimum severity (Critical/High/Medium/Low/Unknown) that blocks promotion when check-critical-vulnerabilities is on.

Critical

promote

Declared intent to promote artefacts. Not consulted by the current handler; promotion happens whenever the gates pass.

true

delete

Delete the staging source after a successful promotion.

false

Nexus configuration (NexusConfig, key nexus)#

Field

Purpose

Default

quarantine

Declared intent to quarantine artefacts. Not consulted by the current handler; non-compliant artefacts are always quarantined.

true

delete

Delete the source artefact after quarantining it.

true

Metrics configuration (MetricsConfig, key metrics)#

Field

Purpose

Default

prometheus_multiproc_dir

Directory for the Prometheus multiprocess registry (shared across Celery worker processes). The Helm chart overrides this to /metrics-registry.

metrics-registry

Environment variables#

Rendered into Kubernetes Secrets from global.env values and injected into the API and/or Celery pods.

Variable

Purpose

Used by

HARBOR_URL

Harbor API base URL, including /api/v2.0.

Celery

HARBOR_USERNAME / HARBOR_PASSWORD

Harbor API credentials (also reused as NOTATION_USERNAME / NOTATION_PASSWORD).

Celery

HARBOR_TOKEN

Expected value of the Harbor webhook authorization header.

API

NEXUS_URL

Nexus base URL.

Celery

NEXUS_API_USERNAME / NEXUS_API_PASSWORD

Nexus API credentials.

Celery

NEXUS_HMAC_SIGNATURE_SECRET

HMAC secret for verifying Nexus webhook signatures.

API

GITLAB_API_REQUESTER

Marvin’s GitLab identity (marvin-42-service).

Celery

GITLAB_API_PRIVATE_TOKEN

GitLab token for opening merge requests.

Celery

MONGO_URL / MONGO_DB / MONGO_COL

MongoDB connection URI, database, and collection for audit records.

Celery

CELERY_BROKER

Redis broker/result-backend URL. The Helm chart constructs this from the bundled redis subchart (redis.auth.password), not from a global.env key.

API + Celery

UNLEASH_PROXY_URL

Unleash Proxy base URL (/proxy is appended by the client).

API + Celery

UNLEASH_PROXY_SDK_TOKEN

Unleash Proxy SDK token (Authorization header).

API + Celery

UNLEASH_ENVIRONMENT

Unleash application name / environment.

API + Celery

UNLEASH_INACTIVE

When set, skips Unleash client initialisation (tests and local runs).

API + Celery

OPENID_SECRET

Secret key for the FastAPI session middleware.

API

VAULT_URL

HashiCorp Vault base URL.

Celery

VAULT_AUTH_APPROLE_ROLE_ID / VAULT_AUTH_APPROLE_SECRET_ID

Vault AppRole credentials.

Celery

VAULT_OCI_PKI_URI

Common name requested from the PKI role when issuing a signing certificate.

Celery

VAULT_PKI_ISSUE_PATH

Vault PKI role path that issues the signing certificate. Defaults to oci-pki/issue/oci-image-signing-24h-ttl-certificate.

Celery

TSA_URL

RFC 3161 timestamping authority used to countersign SBOM signatures. Defaults to DigiCert (http://timestamp.digicert.com).

Celery

TSA_ROOT_CERT

Path to the TSA’s root certificate (PEM). Defaults to ~/.config/notation/tsa-root.crt; the image ships the DigiCert root there, so only override this when pointing TSA_URL at a different authority.

Celery

NOTATION_CONFIG_DIR

Directory holding Notation’s signing configuration (keys, certificates). Defaults to ~/.config/notation.

Celery

CONFIG_PATH

Path to config.yml (default /etc/config/config.yml).

Celery

CELERY_APP_NAME

Name of the Celery application (default Artefact_Validations_Celery).

API + Celery

LOG_LEVEL

Logging level.

API + Celery

Deployment values#

Operational knobs in charts/ska-cicd-artefact-validations/values.yaml (in addition to the global.env credentials and the config block above).

Key

Purpose

Default

image.repository / image.pullPolicy / image.tag

Container image. tag defaults to the chart appVersion.

artefact.skao.int/ska-cicd-artefact-validations / IfNotPresent / (chart appVersion)

resources

CPU/memory requests and limits, applied to both the API and Celery pods.

limits cpu 400m / memory 800Mi; requests cpu 100m / memory 400Mi

pvc.name / pvc.size / pvc.accessMode / pvc.storageClassName

Shared PersistentVolumeClaim backing the Prometheus multiprocess directory, mounted into both deployments. ReadWriteMany requires an RWX-capable StorageClass.

shared-volume-claim / 1Gi / ReadWriteMany / nfss1

docker.host

Docker daemon endpoint for the Celery worker. When null, the worker hostPath-mounts /var/run/docker.sock; set it to point at a remote daemon and disable the socket mount.

null

nodeSelector / tolerations / affinity

Pod scheduling constraints, wired into both deployments.

{} / [] / {}

autoscaling

Horizontal Pod Autoscaler for the Celery worker (enabled, minReplicas, maxReplicas, targetCPUUtilizationPercentage).

enabled: false

ingress.class / ingress.namespacePrefix / ingress.tls / ingress.annotations

Ingress exposing /harbor, /nexus, and /metrics.

nginx / false / [] / kubernetes.io/tls-acme: "true"

redis.auth.password

Password for the bundled redis subchart; the chart builds CELERY_BROKER from it.

(unset)

serviceAccount.create / service.type / service.port

Service account (default: use the namespace default) and the ClusterIP service in front of the API.

false / ClusterIP / 80

Note

The bundled subcharts pin mongodb to bitnamilegacy/mongodb:4.4.5 and redis to bitnamilegacy/redis:6.2.7-debian-11-r60 (chart dependencies redis 14.1.0 / mongodb 10.15.0 in Chart.yaml). Unleash is configured entirely through the global.env.unleash_* values; the chart has no unleash_config key and no custom updateStrategy.

Compliance checks#

Checks live in src/ska_cicd_artefact_validations/checks. Every check returns FAILURE severity, so a failure blocks promotion (Harbor) or forces quarantine (Nexus) and blocks the merge request.

Check

Toggle

Validates

Mitigation

CheckArtefactName

check-component-name

The artefact name matches the SKAO naming regex (ska-... with an optional path prefix).

Rename per the SKAO naming convention.

CheckArtefactTag

check-component-tag

The tag is valid SemVer (or PEP 440 for PyPI artefacts).

Re-tag per the SKAO versioning convention.

CheckArtefactMetadata

check-component-manifest

All required CI_* / GITLAB_* metadata fields are present.

Add the missing fields (listed in the MR) to the artefact metadata.

CheckRawArtefactAsset

check-raw-artefact-asset

For RAW artefacts, each asset is a valid tarball.

Publish a valid tar.gz raw artefact.

Required metadata fields#

CheckArtefactMetadata requires all of: CI_COMMIT_AUTHOR, CI_COMMIT_REF_NAME, CI_COMMIT_REF_SLUG, CI_COMMIT_SHA, CI_COMMIT_SHORT_SHA, CI_COMMIT_TIMESTAMP, CI_JOB_ID, CI_JOB_URL, CI_PIPELINE_ID, CI_PIPELINE_IID, CI_PIPELINE_URL, CI_PROJECT_ID, CI_PROJECT_PATH_SLUG, CI_PROJECT_URL, CI_RUNNER_ID, CI_RUNNER_REVISION, CI_RUNNER_TAGS, GITLAB_USER_NAME, GITLAB_USER_EMAIL, GITLAB_USER_LOGIN, GITLAB_USER_ID.

Harbor labels#

The Harbor handler applies global-scope labels to staging artefacts.

Label

Applied when

InvalidName

CheckArtefactName failed.

InvalidTag

CheckArtefactTag failed.

InvalidMetadata

CheckArtefactMetadata failed.

CheckRawArtefactAsset

CheckRawArtefactAsset failed. (The label rule replaces CheckArtefact with Invalid; this name has no such substring, so it is applied unchanged.)

Note

Invalid* labels are derived at run time by replacing CheckArtefact with Invalid in each failing check’s class name.

Retry policies#

Task / policy

Trigger

Max retries

Delay

main_task

Any exception, including a failed Harbor promotion or ArtefactNotSignedError raised when the in-handler signature poll is exhausted.

6

600 s

Signature poll (in main_task)

The artefact is not yet fully signed (re-checked in-handler, blocking).

signature_check_retries (5)

signature_check_retry_delay_s (30 s)

sbom_sign_task

Any exception.

2

60 s

insertdb_task

Any exception.

2

1200 s

create_merge_request_task

Any exception.

2

1200 s

Celery worker settings (celeryconfig.py): worker_concurrency = 6, worker_prefetch_multiplier = 1, task_soft_time_limit = 3600 s, task_time_limit = 7200 s, task_default_retry_delay = 300 s.

Metrics#

Exposed at /metrics in Prometheus text format, gated by the metrics toggle.

Metric

Type

Labels

Description

check_runtime_seconds

Summary

check_name

Time spent running each check.

num_checks_run

Counter

Total checks executed.

num_checks_failed

Counter

check_name

Checks that failed.

num_uploaded_artefacts

Counter

Artefacts processed.

num_exceptions

Counter

function_name

Exceptions raised in instrumented functions (e.g. insertdb_task, check_vulnerability_report).

MongoDB audit record#

insertdb_task stores one document per processed artefact as a JSON dump of the Artefact object.

Field

Meaning

project

Source repository/project.

name

Artefact name (without version).

tag

Tag/version (or digest for digest-only Harbor pushes).

type

oci / pypi / helm / raw / conan.

id

Nexus component ID (Nexus only).

metadata

Artefact labels/metadata.

assets

List of asset filenames (Nexus).

checks_results

List of check results (see below).

report

Vulnerability report (Harbor only).

group / channel

Conan group and channel (Conan only).

Each entry in checks_results carries: name, result (bool), block_mr (bool — a FAILURE that did not pass), runtime (seconds), check_type (message symbol), description, and mitigation.

Cleanup script#

scripts/delete_dangling_sbom_signature_artifacts.py deletes signature artefacts whose referenced SBOM digest no longer exists. It takes no CLI arguments and is configured entirely through environment variables.

Variable

Purpose

HARBOR_URL

Harbor API base URL, including /api/v2.0 (same form as the service).

DELETE_DANGLING_SIGNATURE_ARTIFACTS_PROJECT

Project to scan.

ROBOT_DELETE_DANGLING_SIGNATURE_ARTIFACTS_ACCOUNT_USERNAME

Robot account username.

ROBOT_DELETE_DANGLING_SIGNATURE_ARTIFACTS_ACCOUNT_SECRET

Robot account secret.

It paginates every repository in the project, identifies signature artefacts by their sha256-... tags, resolves each tag to the SBOM digest it references, and deletes the artefact when that SBOM no longer exists. It runs from the scheduled clean-dangling-signature-artifacts CI job.