Skip to Content
Xeonr Developer Docs

Onboarding a service

What a Xeonr service sets up to run its work on pipelines, in the order it needs it.

This page is for a Xeonr service that wants to run its work on pipelines: CI steps, media jobs, scheduled tasks. It goes in the order a new service needs things. For every field, read the protos (xeonr/protocol, modules/xeonr-pipelines/xeonr/pipelines/v1). Each RPC's comment says who may call it and what it refuses.

Every example calls prod, https://pipelines.xeonr.io. ConnectRPC over JSON is a plain POST:

curl -sS https://pipelines.xeonr.io/xeonr.pipelines.v1.<Service>/<Method> \
  -H "Authorization: Bearer $PIPELINES_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{ ... }'

The pipelines CLI covers runs, stored pipelines, schedules, queues, secrets, steps and pools. It uses the same token in PIPELINES_TOKEN, and the tenant in PIPELINES_TENANT or --tenant. It has no commands yet for tenant policies, sinks or registry logins, so this page shows those calls as JSON.

1. Set up your team and service account

Pipelines has one rule: you act for a tenant by being a member of its team. Your service is the tenant. It runs everything under one team, and every call names that team's URN, urn:xeonr:auth:team:<id>, as tenant.

Set up in Xeonr Auth:

  1. A platform team for your service. Its description should say what the team is for and that it must not be deleted. Team forge is an example.
  2. Entitle the team to the pipelines application. This is required. Pipelines asks Auth about membership with its own credential, and Auth only answers for teams entitled to pipelines. A team without the entitlement looks empty, so every call is refused. The team doesn't need to be entitled to your service's own application.
  3. A service account of your service's own Auth application, made a member of the team. Service-account members write. People in the team only read: they see runs and logs in the console, but every write they attempt is permission_denied.
  4. Bind the service account to the pipelines application with the scopes it uses and no more. Also list those scopes on the service account itself. Auth refuses a token exchange that asks for a scope the account doesn't list, even when the binding approved it.

The account needs no Auth scope, not even auth:teams:read. Pipelines never forwards your token to Auth and never reads its teams claim.

Pipelines' scopes are pipelines:<resource>:read and pipelines:<resource>:edit. Within a resource, edit includes read.

ScopeFor
pipelines:run:read / editRunsService: start (CreateRun, CreateJob), read, cancel, retry, release and settle runs; logs, outputs, issues, traces. ValidateDefinition needs run:read
pipelines:pipeline:read / editPipelinesService: stored pipelines, their drafts, versions and publishing
pipelines:package:read / editRegistryService: publish, review and yank step packages; registry logins for pushing images
pipelines:secret:read / editSecretsService: secrets, registry logins and their policies. Reading the sealing key needs secret:read
pipelines:policy:read / editTenantPoliciesService: tier, audience, retention and fact-attester policies
pipelines:sink:read / editSinksService: where your run events are delivered
pipelines:pool:read / editPoolsService: your runner pools, join tokens and runners
pipelines:queue:read / editQueuesService: job queues
pipelines:schedule:read / editSchedulesService: cron schedules
pipelines:worker:editSDK workers that claim and run your handlers

A service that only starts runs, reads them and has a sink needs run:edit and sink:edit. It also needs policy:edit to set its policies, though it can drop that once they're set.

Tell the platform team before you go live. Breaking changes to pipelines are migrated for every service that depends on it, and that only works if we know you depend on it.

2. Get a token

Exchange the service account's assertion with the jwt-bearer grant (see Service tokens). Narrow the token to pipelines with resource:

curl -sS https://auth.xeonr.io/api/v1/oauth/token \
  --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer' \
  --data-urlencode "assertion=$SERVICE_ACCOUNT_ASSERTION" \
  --data-urlencode 'resource=https://pipelines.xeonr.io' \
  --data-urlencode 'scope=pipelines:run:edit pipelines:sink:edit pipelines:policy:edit'

Pipelines accepts only tokens whose audience is https://pipelines.xeonr.io. The token lasts an hour, and there is no refresh token: exchange the assertion again.

3. Set your policies and sink

Policies

TenantPoliciesService holds four policies, each a singleton for your tenant. A Set call replaces the whole policy: a field you leave out is cleared. Changes apply to attempts offered after the call; nothing restarts. Your service accounts and the platform's operators can set them.

Tier policy (SetTierPolicy). Without one, every attempt gets the untrusted tier. Rules are tried in order, and the first one that matches wins. A rule matches on the run's attested facts and, optionally, the step package. It holds:

  • rules: the tier rules.
  • pools_only_tiers: tiers that never run on container-platform.
  • offer_timeout: how long an attempt waits for a pool to claim it before it fails no_worker. It is never moved to container-platform instead.
  • fairness_fact: the attested fact that keeps your own customers fair with each other (the forge uses group.path). See quotas and fairness.
  • cp_network: which tiers may hold the network capability on container-platform.
  • cp_namespaces, cp_egress_policies: run a tier in a container-platform namespace and egress policy of your own (below).
curl -sS https://pipelines.xeonr.io/xeonr.pipelines.v1.TenantPoliciesService/SetTierPolicy \
  -H "Authorization: Bearer $PIPELINES_TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "tenant": "urn:xeonr:auth:team:<id>",
    "rules": [
      {"tier": "deploy",  "when": [{"fact": "protected", "anyOf": [true]}],
                          "packages": ["acme/deploy"]},
      {"tier": "trusted", "when": [{"fact": "protected", "anyOf": [true]}]}
    ],
    "fairnessFact": "customer.id"
  }'

PoolsService.ListTiers lists the tiers that exist. A steps node is never given deploy.

Identity-token audiences (SetIdTokenAudiencePolicy). This is only needed if your steps mint job identity tokens to prove to another service which run they are. It denies by default. An audience must be your own team URN, or one name beneath it (urn:xeonr:auth:team:<id>/deploy). Anything else is refused, and nothing is asked of Auth. audience_packages can limit an audience to named step packages of your own. A node also has to list the audience in id_token_audiences. Tokens are RS256, issued by https://pipelines.xeonr.io, with keys at https://pipelines.xeonr.io/.well-known/jwks.json.

Retention (SetRetentionPolicy). Finished runs are kept forever unless you set finished_runs (one day to a year). keep_last_per_schedule_target keeps the newest few runs of each schedule target past that window.

Fact attesters (SetFactAttesterPolicy). Optionally, list the principals (subject URNs) whose attested facts your runs accept. Once the list is set, a run with facts from anyone else is refused, and only a listed principal (or an operator) can change it.

Running in your own container-platform namespace

By default, container-platform attempts run in pipelines' own namespaces under pipelines' quota. cp_namespaces (keyed by untrusted, trusted, deploy) runs a tier in a namespace your team owns instead, under that namespace's quota:

  1. The namespace must be owned by your team. Pipelines checks this when you set the policy and again before every launch. deploy never shares a namespace with another tier.
  2. A platform operator has to let pipelines operate there. A namespace owner can't grant that yet, so ask.
  3. A tier named here runs only there. If the namespace is unusable, the attempt fails and says why. It never falls back to pipelines' namespace.

cp_egress_policies names a container-platform egress policy (egp-…) in that tier's namespace, so its jobs can reach what the policy allows. Pipelines adds its own hosts to the policy.

Your sink

To hear what became of your runs, serve RunEventSinkService.ReportRunEvents and register it:

curl -sS https://pipelines.xeonr.io/xeonr.pipelines.v1.SinksService/SetSink \
  -H "Authorization: Bearer $PIPELINES_TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "tenant": "urn:xeonr:auth:team:<id>",
    "url": "https://acme.xeonr.io/pipelines-sink",
    "audience": "urn:xeonr:auth:team:<id>/run-events",
    "authentication": "SINK_AUTHENTICATION_PIPELINES_SIGNED"
  }'

Delivery is at least once, in any order:

  • Dedupe on (run_id, seq), and never move your own state backwards on an older seq. GetRun is the record; events are a notification.
  • Refuse single events in rejected rather than failing the call, so the rest are acknowledged. A permanent code kills the event. A transient one has it sent again after a backoff.
  • A run's later events wait until its earlier ones are delivered or dead. GetSink shows pending_events, oldest_pending_at and last_error.
  • A bound output of a stored pipeline arrives as RUN_EVENT_KIND_OUTPUT_COMMITTED, with a presigned URL for each blob. Copy the blob before you acknowledge the event.

Choose how deliveries authenticate with authentication:

  • SINK_AUTHENTICATION_PIPELINES_SIGNED (simplest). Pipelines signs a five-minute RS256 token itself, and no Auth binding is needed. The audience must be your team URN or a name beneath it. Your sink verifies against Sink.token_issuer and the keys at Sink.jwks_url, and must check all of these:
    • aud is exactly your registered audience;
    • sub is urn:xeonr:pipelines:run-events;
    • token_use is run_events;
    • tenant is your team URN.
  • SINK_AUTHENTICATION_AUTH_SERVICE_TOKEN (the default). Pipelines calls with an Auth token of its sink service account, audienced to your audience. Create a service-account-only scope on your application (<service>:run-events:report by convention), grant it to that account through an approved binding, and refuse every other principal in the handler.

The same base URL can also serve BlobInputSinkService (to refresh expired run inputs) and ScheduleTargetService (for schedules that call you back), both described below.

4. Run work

CreateRun takes:

  • tenant;
  • resource: what the run is about, as {kind, id, json} in your service's own terms. The definition reads it as ${{ resource.<path> }}. Use an id that survives renames.
  • attested_facts: facts your service vouches for, such as the repository, the ref, whether it is protected, or the customer. Tier rules, secret policies and identity tokens match on them, and steps read them as PIPELINES_FACT_*. They never come from the definition.
  • a source: an inline_definition, or a pipeline (a published version of a stored pipeline, by id or by scope and name).
curl -sS https://pipelines.xeonr.io/xeonr.pipelines.v1.RunsService/CreateRun \
  -H "Authorization: Bearer $PIPELINES_TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "tenant": "urn:xeonr:auth:team:<id>",
    "idempotencyKey": "acme:job:4821",
    "resource": {"kind": "acme.project", "id": "0f3c9a2e-8f1b-4c2d-9e6a-1b2c3d4e5f60"},
    "attestedFacts": {"customer": {"id": "c-17"}, "protected": false},
    "exclusion": {"key": "acme.project:0f3c9a2e:build", "onConflict": "CONFLICT_POLICY_QUEUE"},
    "inlineDefinition": {
      "name": "build",
      "nodes": [{
        "id": "build",
        "uses": {"name": "platform/script", "version": "1.0.0"},
        "with": {"image": "golang:1.26", "script": ["go build ./..."]},
        "timeout": "900s"
      }]
    }
  }'

Or with the CLI, from a definition file:

pipelines runs start --definition build.yaml --resource acme.project:<id> \
  --facts facts.json --idempotency-key acme:job:4821 \
  --exclusion-key acme.project:<id>:build --on-conflict queue --wait
pipelines validate build.yaml   # the same checks as CreateRun, creating nothing
  • Idempotency keys are unique per tenant. A retry with the same key returns the first run.
  • Exclusion keys make runs that share a key, within your tenant, mutually exclusive. With QUEUE a new run waits visibly. With CANCEL_OLDER it supersedes the older run, unless one of that run's non-interruptible nodes has started.
  • Priority (-10 to 10) orders your own waiting work only. It never jumps another tenant's.
  • on_behalf_of records which of your users asked for the run. It is shown back to you and grants nothing.
  • Blob inputs by reference. blob_inputs names an HTTPS URL you serve (typically a presigned GET), with an optional sha256, size_bytes and expires_at. Pipelines never copies the bytes. A node reads ${{ inputs.blobs.<name> }} (staged and verified before the step starts) or ${{ inputs.blobs.<name>.url }} (handed over as a URL). The URL is held like a secret. If it expires, pipelines calls your sink's BlobInputSinkService.RegenerateBlobInputUrl. A service that doesn't serve that keeps the original URL, and an attempt that reads it after it has expired fails input_expired.
  • Stored pipelines have a draft, published versions, declared variables, a concurrency policy and output_bindings, which are delivered to your sink. See PipelinesService and pipelines pipelines --help.

Following a run. GetRun returns the run. GetRunGraph returns every node, attempt, output, issue count and the progress of a running attempt. Logs are per attempt: GetLogs reads by offset, TailLogs streams, and GetRunLogs covers the whole run. GetBlobOutput downloads an output. ListIssues and GetRunTrace show what the steps reported. With the CLI: pipelines runs get <run> --wait, pipelines logs <run> [node] --follow.

Changing a run. CancelRun cancels ({"runId": "…", "reason": "…"}). RetryNode re-runs one node of a finished run and everything downstream of it. ReleaseNode releases a manual node. SettleNode settles an await node, which waits for your service's judgement (for example, the watch after a rollout).

5. Steps

platform/[email protected] runs script (a list of commands) in image, with optional before_script, after_script, env and a source blob unpacked into the work directory. The image needs only /bin/sh.

platform/[email protected] takes the same inputs and an optional shell: bash, sh, zsh, pwsh or powershell, which must be on the image's PATH (or, for a step on a host runner, the host's). Unset, the commands run in bash if it is there, else sh; on a Windows host in pwsh, else Windows PowerShell. before_script and script share one shell; after_script runs in a fresh one of the same kind. Any other value is refused when the run is created. 1.0.0 stays as it was.

A steps node runs several run: scripts (and at most one typed step) in one image with one work directory. Treat it as one trust domain: any step can read a secret given to any other. It is never given the deploy tier.

Secrets are granted to a node by name (Node.secrets) and reach the step through a sealed channel, as environment variables or files. A ${{ secrets.… }} reference anywhere in with is refused. A secret's policy denies by default. It names the facts, step packages and tiers that may receive it, or the wildcards any_facts, any_package and any_tier. pipelines secrets put seals the value on your machine before sending it.

Your own step packages. Publish to a namespace your team owns (RegistryService.PublishVersion, pipelines:package:edit). Your first publish to an unclaimed namespace claims it for your team. Versions are immutable: a new version is a new publish, and MarkVersionYanked stops new runs from using an old one.

pipelines steps publish --manifest manifest.yaml --name acme/thumbnail \
  --version 0.1.0 --image registry.pipelines.xeonr.io/acme/thumbnail@sha256:<digest>
  • Visibility. A package is PRIVATE (only your tenant can use it) by default, or PUBLIC (any tenant). The first publish sets it for good.
  • Images. Push to the registry's own repositories (registry.pipelines.xeonr.io/<namespace>/<name>) with a short-lived login from CreateRegistryCredential. Tags there are write-once. An image in any other registry works too.
  • Capabilities. A package in your namespace can't ask for network or privileged in its manifest. Only the platform's and first-party namespaces can (the forge's ci/ is one, and making one needs an operator). A definition can still give a platform/script node network in runs_on.capabilities.
  • Review. SetNamespaceGate makes every new version wait as PENDING until one of your service accounts marks it READY (MarkVersionReviewed).

Private images. Store a registry login as a secret of type SECRET_TYPE_REGISTRY_LOGIN with its registry host, sealed as {"username", "password"}. It is never given to a step. A run uses its resource's login, then its tenant's, and never another tenant's.

6. Where work runs

Each attempt is routed once, when it is offered, and the route never changes:

  1. To a runner pool, if a pool record of your tenant (or a platform pool) could claim it. This is judged on pool records, not on whether runners are online, so bring your runners up before you create a pool that matches.
  2. Otherwise to container-platform, which needs no setup.
  3. Otherwise nowhere. CreateRun refuses the run and says why.

Container-platform runs each attempt as a gVisor job on linux/amd64. It refuses docker, privileged, host_runtime, other OSes and architectures, and worker handlers. It ignores runs_on.labels. runs_on.resources size the step within the deployment's bounds; without them a step gets the default class (2 CPU, 4 GiB). Without network, a step reaches only pipelines' own hosts. With it, a step can reach any public host through the egress proxy. Private and link-local addresses are never reachable. deploy runs in a namespace of its own, on the same machines as the other tiers.

Your own runner pool, for machines you run yourself:

  1. Create it (PoolsService.SetPool or pipelines pools upsert -f pool.yaml) with owner {kind: tenant, tenant: <your team URN>}, a tier, os, arch, labels, capabilities and per-slot resources. allowed_facts narrows the runs it takes.

  2. Mint a join token: pipelines pools join-token <pool>. It works once, for ten minutes by default.

  3. Start the stock agent with PIPELINES_API_URL=https://workers.pipelines.xeonr.io and PIPELINES_RUNNER_JOIN_TOKEN. It exchanges the token for its own credential on first start. Remove the token once credential.json exists.

    • Docker host: image registry.prod.wtf/xeonr/pipelines/runner/agent with PIPELINES_RUNNER_SIDECAR_IMAGE set to registry.prod.wtf/xeonr/pipelines/runner/sidecar pinned by digest. It needs the Docker socket and a state volume.
    • Mac, Linux or Windows host (PIPELINES_RUNNER_DRIVER=shell): the pipelines-agent and pipelines-step binaries from the agent-v… and step-v… releases of xeonr/pipelines/runner, run under launchd, systemd or as a Windows service. Steps run as the agent's own user and can read its credential, so a shell pool must belong to one tenant, sit on a tier above untrusted, and take only protected work (allowed_facts). In prod the agent refuses anything else.

    The runner repository's README has the full settings and install steps for each driver.

  4. Pool variables (Pool.variables) are plain values, such as a cache endpoint or a registry mirror, given to every step the pool runs. They are not secrets: anyone who can read the pool reads them, and a step can print them.

GetPoolDemand gives an autoscaler a suggested size. Pipelines starts and stops no machine itself.

Tiers and pools together. A pool serves one tier. Put a tier in pools_only_tiers to keep it off container-platform. Its attempts then wait for a pool, failing no_worker after your offer_timeout. Platform pools are run by the operators. Ask if your work needs one.

7. Schedules

SchedulesService.SetSchedule (or pipelines schedules set -f schedule.yaml) declares a cron schedule with a time zone. At each occurrence it fires once per target (one target, a stored list, or targets a handler returns), and it does one of three things:

  • starts a published version of a stored pipeline;
  • enqueues a job to a worker handler;
  • calls your service back (fire, with your own reference and parameters). Your service decides what to run, with its own definition and facts.

A fire target calls ScheduleTargetService.FireSchedule at your sink's URL, authenticated the way your sink is. In signed mode the token's sub is urn:xeonr:pipelines:schedule-fires, token_use is schedule_fire, and its JOSE typ is schedule-fire+jwt, so a run-event token never passes as a fire. In Auth-token mode, gate the handler with a service-account-only scope of your own (<service>:schedule:fire by convention). Answer with:

  • FIRE_OUTCOME_STARTED and the run_id you created with CreateRun; or
  • FIRE_OUTCOME_DECLINED with a reason.

Retries carry the same fire_id. Start at most one run per fire_id, and give a repeated id the same answer as the first. A permanent error code counts as a decline. Other errors are retried for up to eight calls.

Misfires never build a backlog: latest fires only the most recent missed occurrence within catchup_window. Your service accounts can override a schedule's cron or enabled flag (pipelines schedules override), and the override survives your service declaring the schedule again.

8. Limits and gotchas

Services on container-platform

A node's services (a database beside a test, say) run in the same pod as the step:

  • One network. The step, the sidecar and every service share 127.0.0.1, and each service's name resolves to it. Two services can't listen on one port, and none may use 15010, which is the sidecar's. Reach a service as db:3306 or 127.0.0.1:3306. A service reaches the step on 127.0.0.1.
  • HTTP clients use the egress proxy. NO_PROXY covers only localhost,127.0.0.1,::1, so a client that honours HTTP_PROXY sends http://db:9200 to the proxy, which refuses it. Use 127.0.0.1, or add the service's name to NO_PROXY in your script.
  • Readiness comes from the image. The image's HEALTHCHECK is used if it has one. Otherwise pipelines does a TCP check on its lowest exposed port, so the service must listen on 0.0.0.0. Otherwise the service counts as up once started. The wait is 120 s. A definition can't set its own check yet.
  • At most four services per node. Each gets 500m CPU and 512 MiB on top of the step, which you can't change yet.
  • Private images. Before an attempt is offered, pipelines checks that your run's own registry login (or anonymous access) can read every image it names. Container-platform then pulls with its own credentials, and it has no per-job credential. Public images, registry.prod.wtf's xeonr images and images on pipelines' own registry pull fine. A private image hosted anywhere else fails image_pull, so run that work on a pool. In a namespace of your own, images on pipelines' registry also need the namespace to carry its pull secret, which a platform admin sets.

Quotas and fairness

  • Run quota: 5,000 runs per five minutes per tenant, and 1,000 per fairness key. Past either, CreateRun answers resource_exhausted.
  • Fairness key: your tier policy's fairness_fact (for jobs, CreateJobRequest.fairness_key). A pool shares its claims fairly between your keys, and a job queue's per-tenant cap applies per key. Without a key, all your runs are one lane.
  • Caches are kept per tenant, resource and tier, under a tenant quota and a 5 GiB cap per resource. A save over a quota is refused, and nothing is evicted to make room.
  • Shared per tenant: idempotency keys, exclusion keys, schedule and queue names, tenant-wide secrets, and who can read runs and logs (your team). Keep your customers apart with the run's resource and facts, and with secret policies.

Usage

Each attempt's CPU, memory and wall time are reported on the attempt and in node.finished events (RunEvent.usage), so you can meter your own customers. On container-platform, only the wall time is filled in today.

On this page