Configuration

Configuration reference for the CI Sizer collector and receiver binaries.

Collector Configuration

The collector runs alongside CI workloads, reads /proc, and pushes a run summary to the receiver on shutdown.

Collector Flags

FlagEnvironment VariableDescriptionDefault
--intervalCollection interval (e.g., 5s, 1m)5s
--proc-pathPath to proc filesystem/proc
--log-levelLog level: debug, info, warn, errorinfo
--log-formatOutput format: json, textjson
--topNumber of top processes to include5
--push-endpointHTTP endpoint to push metrics to
--push-tokenCOLLECTOR_PUSH_TOKENBearer token for push endpoint auth
--hardware-profileRUNNER_HARDWARE_PROFILEHardware profile: JSON, preset name, or empty for auto-detectauto-detect
--carbon-providerRUNNER_CARBON_PROVIDERCarbon intensity provider: energy-charts (default, full 3-tier: Energy Charts → FfE → static), ffe (legacy alias, same chain), static (static table only)energy-charts
--carbon-zoneRUNNER_CARBON_ZONECarbon intensity zoneDE
--pueRUNNER_PUEPower Usage Effectiveness multiplier1.3

Carbon Zone

The carbon zone determines which electricity grid is used for carbon intensity estimation.

FlagEnvDefaultDescription
--carbon-zoneRUNNER_CARBON_ZONEDEISO 3166-1 alpha-2 country code for the electricity grid zone

Supported zones:

ZoneCountryTypical CI (gCO₂eq/kWh)Notes
ATAustria~67Hydro-dominated
BEBelgium~179Gas + nuclear mix
CHSwitzerland~42Hydro + nuclear
DEGermany~258Mixed (coal/gas/wind/solar)
DKDenmark~88Wind-heavy
ESSpain~94Solar + wind + gas
FIFinland~59Nuclear + hydro + biomass
FRFrance~24Nuclear-dominated
ITItaly~206Gas-heavy
NLNetherlands~369Gas-dominated
NONorway~28Hydro-dominated
PLPoland~505Coal-dominated
SESweden~33Hydro + nuclear

Example:

# French grid (nuclear-dominated, very low CI)
./collector --carbon-zone FR

# Or via environment variable
RUNNER_CARBON_ZONE=PL ./collector

Provider chain per zone:

  • DE: Energy Charts → FfE blob projection → static (seasonal/weekday)
  • All others: Energy Charts → static (seasonal/weekday table with 192 values)

FfE projection data is only available for Germany. For all other zones, the static fallback provides a seasonal/weekday/hourly profile (192 values) when Energy Charts is unavailable.

CI Context Environment Variables

These environment variables identify the CI run context. They are typically set automatically by GitHub Actions / Forgejo Actions.

VariableDescriptionExample
GITHUB_REPOSITORY_OWNEROrganization namemy-org
GITHUB_REPOSITORYFull repository pathmy-org/my-repo
GITHUB_WORKFLOWWorkflow filenameci.yml
GITHUB_JOBJob namebuild
GITHUB_RUN_IDUnique run identifierrun-123
CGROUP_PROCESS_MAPJSON: process name to container name{"node":"runner"}
CGROUP_LIMITSJSON: per-container CPU/memory limitsSee below

CGROUP_LIMITS Format

{
  "runner": { "cpu": "2", "memory": "1Gi" },
  "sidecar": { "cpu": "500m", "memory": "256Mi" }
}

CPU supports Kubernetes notation ("2" = 2 cores, "500m" = 0.5 cores). Memory supports Ki, Mi, Gi, Ti (binary) or K, M, G, T (decimal).

Note: The collector reads GITHUB_REPOSITORY (e.g., my-org/my-repo) and automatically strips the organization prefix before pushing — the payload’s repository field contains only my-repo. When generating push tokens via POST /api/v1/token, the repository field must use the short name (without the org prefix).

Receiver Configuration

The receiver stores metric summaries, serves the web UI, and provides the sizing and query APIs.

Receiver Flags

FlagEnvironment VariableDescriptionDefault
--addrHTTP listen address:8080
--dbSQLite database pathmetrics.db
--read-tokenRECEIVER_READ_TOKENPre-shared token for read/admin endpoints
--hmac-keyRECEIVER_HMAC_KEYSecret key for push token generation/validation
--token-ttlTime-to-live for push tokens2h
--auth-modeRECEIVER_AUTH_MODEAuthentication mode: none, oidc, gatewayauto-detect
--cpu-sizing-modeRECEIVER_CPU_SIZING_MODECPU sizing mode: observe or enforceobserve
--memory-qosRECEIVER_MEMORY_QOSMemory QoS class: guaranteed or burstableguaranteed
--log-levelRECEIVER_LOG_LEVELLog level: debug, info, warn, errorinfo

OIDC / Authentication Flags

FlagEnvironment VariableDescriptionDefault
--oidc-issuerRECEIVER_OIDC_ISSUEROIDC issuer URL
--oidc-client-idRECEIVER_OIDC_CLIENT_IDOIDC client ID
--oidc-client-secretRECEIVER_OIDC_CLIENT_SECRETOIDC client secret
--oidc-redirect-uriRECEIVER_OIDC_REDIRECT_URIOIDC redirect URI
--session-ttlSession cookie TTL12h
--session-signing-keyRECEIVER_SESSION_SIGNING_KEYHex-encoded 32-byte session signing keyauto-generate
--cookie-secureRECEIVER_COOKIE_SECURESet Secure flag on auth cookies; disable for plain HTTPtrue
--allowed-orgRECEIVER_ALLOWED_ORGAllowed organization for OIDC login
--logout-urlRECEIVER_LOGOUT_URLExternal logout URL for gateway mode

JWT Claim Mapping

FlagEnvironment VariableDescriptionDefault
--claim-subRECEIVER_CLAIM_SUBJWT claim for user IDsub
--claim-nameRECEIVER_CLAIM_NAMEJWT claim for display namename
--claim-emailRECEIVER_CLAIM_EMAILJWT claim for emailemail
--claim-groupsRECEIVER_CLAIM_GROUPSJWT claim for groups arraygroups
--claim-orgRECEIVER_CLAIM_ORGJWT claim for organizationorg
--org-from-groupsRECEIVER_ORG_FROM_GROUPSOrg extraction from groups: first, match, nonefirst

GARM Integration Flags

FlagEnvironment VariableDescriptionDefault
--garm-urlGARM_URLGARM base URL for WebSocket event enrichment
--garm-userGARM_USERGARM username for JWT authentication
--garm-passwordGARM_PASSWORDGARM password for JWT authentication
--garm-cache-ttlGARM_CACHE_TTLTTL for pending GARM event cache60s

OOM Detection & Notification Flags

FlagEnvironment VariableDescriptionDefault
--max-memoryRECEIVER_MAX_MEMORYNode ceiling for memory (overrides auto-detection from /proc/meminfo)auto (90% node RAM)
--max-cpuRECEIVER_MAX_CPUNode ceiling for CPUauto
--notify-enabledRECEIVER_NOTIFY_ENABLEDEnable commit status notifications on OOMfalse
--notify-base-urlRECEIVER_NOTIFY_BASE_URLForge base URL (auto-detected if unset)
--notify-tokenRECEIVER_NOTIFY_TOKENAPI token for forge commit status API

Multi-Provider Flags

FlagEnvironment VariableDescriptionDefault
--ci-providerCI_PROVIDERCI provider: forgejo, github, gitlabforgejo

GitLab-Specific Variables

These variables are relevant when CI_PROVIDER=gitlab:

VariableDescriptionDefault
CI_SIZER_RUNNER_NAMEOverride runner name (defaults to pod name for GitLab)pod name
CGROUP_STRATEGYCgroup mapping strategy: default or exclusiondefault

Set CGROUP_STRATEGY=exclusion for GitLab pods where the build container process name is unpredictable. See GitLab Integration for details.

Authentication Modes

CI Sizer supports three authentication modes, configured via --auth-mode:

ModeDescription
noneToken-only authentication. All protected endpoints accept the Bearer read token.
oidcDirect OIDC login via Dex, Keycloak, or Entra ID. Most endpoints require an OIDC session cookie; sizing endpoints also accept a Bearer read token for programmatic access.
gatewayExternal API gateway (e.g., APISIX) handles authentication and forwards JWTs. All protected endpoints accept the gateway JWT or Bearer read token.

When --auth-mode is not set, the receiver auto-detects: if --oidc-client-id is provided, it defaults to oidc; otherwise it defaults to none.

Kubernetes Deployment

Receiver Deployment

docker build -f Dockerfile --target receiver -t ci-sizer-receiver:local .

kubectl create namespace ci-sizer
kubectl -n ci-sizer create secret generic receiver-secrets \
  --from-literal=read-token=my-secret-token \
  --from-literal=hmac-key=my-hmac-key
apiVersion: apps/v1
kind: Deployment
metadata:
  name: receiver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: receiver
  template:
    metadata:
      labels:
        app: receiver
    spec:
      containers:
      - name: receiver
        image: ci-sizer-receiver:local
        ports:
        - containerPort: 8080
        env:
        - name: RECEIVER_READ_TOKEN
          valueFrom:
            secretKeyRef:
              name: receiver-secrets
              key: read-token
        - name: RECEIVER_HMAC_KEY
          valueFrom:
            secretKeyRef:
              name: receiver-secrets
              key: hmac-key
        args: ["--addr=:8080", "--db=/data/metrics.db"]
        volumeMounts:
        - name: data
          mountPath: /data
      volumes:
      - name: data
        emptyDir: {}

For persistent storage, replace the emptyDir volume with a PersistentVolumeClaim.

For plain HTTP deployments (local dev, port-forward), set RECEIVER_COOKIE_SECURE=false to prevent OIDC login failures caused by browsers rejecting Secure cookies over HTTP.

Collector Sidecar

The collector runs as a sidecar in CI pods with shareProcessNamespace: true. Generate a push token first, then deploy:

apiVersion: v1
kind: Pod
metadata:
  name: ci-run-test
spec:
  shareProcessNamespace: true
  restartPolicy: Never
  containers:
  - name: runner
    image: busybox:latest
    command: ["/bin/sh", "-c", "while true; do dd if=/dev/zero of=/dev/null bs=1M count=100 2>/dev/null; sleep 1; done"]
    resources:
      limits:
        cpu: "500m"
        memory: "256Mi"
  - name: collector
    image: ci-sizer-collector:local
    args: ["--interval=2s", "--top=5", "--push-endpoint=http://receiver.ci-sizer.svc.cluster.local/api/v1/metrics"]
    env:
    - name: COLLECTOR_PUSH_TOKEN
      value: "<PUSH_TOKEN>"
    - name: GITHUB_REPOSITORY_OWNER
      value: "my-org"
    - name: GITHUB_REPOSITORY
      value: "my-org/my-repo"
    - name: GITHUB_WORKFLOW
      value: "ci.yml"
    - name: GITHUB_JOB
      value: "build"
    - name: GITHUB_RUN_ID
      value: "test-run-001"
    resources:
      limits:
        cpu: "100m"
        memory: "64Mi"