Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.
Importing Tekton pipelines
Hive can read Tekton (and OpenShift Pipelines) resources and propose a lifecycle workflow model that knows how a repository builds and ships. Each Tekton pipeline becomes a pipeline (a DAG of tasks) inside the model. Hive renders the pipelines and binds them to lifecycle states; Tekton keeps running them. Hive does not create, re-run or cancel PipelineRuns.
There are two sources:
- Files: Tekton YAML in the repository (for example a
.tekton/directory used by Pipelines-as-Code), or pasted into the API. - A live cluster: hive lists Tekton resources through
kubectland ingests them with the same parser.
For how this fits with the other kinds of workflow, see Workflows in hive. The GitHub Actions equivalent is Importing GitHub Actions workflows; a repository ingest reads both at once. To have hive run a DAG on its own agents instead, author it natively as a DAG workflow, or import this pipeline as a DAG workflow draft.
Import from repository files
Prerequisites
- Owner role on the hive. Saved ingests are audited as
workflow_ingest. - Read access to the repository for the hive’s GitHub credential, when you ingest by repository name. Pasting files needs no repository access.
Which files are read
When ingesting a repository, hive keeps:
- every YAML file under
.tekton/,tekton/,pipelines/,.pipelines/,openshift/ci/orci/tekton/at the repository root; - other YAML files whose name suggests a pipeline and whose content looks like Tekton.
A file may hold several YAML documents or a Kubernetes List. Every document whose
apiVersion is in tekton.dev, triggers.tekton.dev or pipelinesascode.tekton.dev is
considered. Pasted files (API files) are read when the path ends in .yml or .yaml and the
content looks like Tekton.
From the dashboard
- Open Settings → Workflows and choose Ingest.
- Pick the repository in Repository, or type it in or owner/repo.
- Optionally set Save as, then choose Preview or Ingest and save.
The result shows whether the model compiles, its Diagnostics and a Proposed columns diagram, with Open in editor to review it on the canvas.
With the API
POST /api/workflows/ingest is the same call as for GitHub Actions: exactly one of repo
(owner/name) or files (path → contents), plus optional save and name. See
Importing GitHub Actions workflows for the
response fields and errors.
jq -n \
--rawfile pipeline .tekton/build-pipeline.yaml \
--rawfile pr .tekton/build-pull-request.yaml \
--rawfile push .tekton/build-push.yaml \
'{name: "example-app-tekton",
files: {".tekton/build-pipeline.yaml": $pipeline,
".tekton/build-pull-request.yaml": $pr,
".tekton/build-push.yaml": $push}}' |
curl -s -X POST https://hive.example/api/workflows/ingest \
-H "Authorization: Bearer $HIVE_TOKEN" \
-H "Content-Type: application/json" \
-d @-
Import from a live cluster
Cluster ingest reads what is installed rather than what is in a repository. Hive runs
kubectl get <resource> -o json for, in order:
| Resource | Required |
|---|---|
pipelines.tekton.dev | Yes: without it the cluster has no Tekton and the ingest stops |
tasks.tekton.dev | No |
pipelineruns.tekton.dev | No |
eventlisteners, triggertemplates, triggerbindings, triggers in triggers.tekton.dev | No; when the Triggers CRDs are missing the ingest records triggers-crd-missing and continues |
Each object is written to a virtual file cluster/<namespace>/<kind>/<name>.yaml (server-side
fields such as managedFields, resourceVersion and uid are dropped, and status is kept on
PipelineRuns only) and passed to the same Tekton parser as repository files. Citations in the
model point at those virtual paths.
Prerequisites
- Owner role on the hive.
kubectlon the hive’sPATH, and either a kubeconfig (KUBECONFIGor~/.kube/config) or an in-cluster ServiceAccount token. Without them the cluster panel is disabled and the API answers422with the reason.- A context. Leave it empty to use kubectl’s current context, or name one from the
kubeconfig.
GET /api/workflows/ingest/capabilitieslists the contexts the hive can see. - RBAC for the identity in that context:
getandliston the resources above, in the namespace you ingest (aRoleandRoleBinding), or cluster-wide for all namespaces (aClusterRoleandClusterRoleBinding). Grant the Triggers resources too when the Triggers CRDs are installed: a missing CRD is skipped, but a denied list stops the ingest with403.
A namespaced read-only role:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: hive-tekton-reader
namespace: ci
rules:
- apiGroups: ["tekton.dev"]
resources: ["pipelines", "tasks", "pipelineruns"]
verbs: ["get", "list"]
- apiGroups: ["triggers.tekton.dev"]
resources: ["eventlisteners", "triggertemplates", "triggerbindings", "triggers"]
verbs: ["get", "list"]
From the dashboard
On Settings → Workflows → Ingest, open From a cluster under Other sources:
- Context: a context from the list, or the current context;
- Namespace, or All namespaces (capped at 25);
- Label selector (optional), applied to every list;
- Save as (optional; the default is derived from the context and namespace).
Preview or Ingest and save shows the same result block as a repository ingest plus Observed runs: the last PipelineRun per pipeline and its status.
With the API
POST /api/workflows/ingest/cluster:
| Field | Type | Meaning |
|---|---|---|
context | string | Kubeconfig context; empty uses the current context |
namespace | string | Namespace to read; required unless allNamespaces is set |
allNamespaces | boolean | Read every namespace, capped at 25 |
selector | string | Label selector applied to every list |
runsPerPipeline | integer | Newest PipelineRuns kept per pipeline (default 3, at most 20) |
repository | string, owner/name | Repository the model is scoped to; defaults to one derived from the context and namespace |
save | boolean | Store the result at the next free version |
name | string | Model name |
curl -s -X POST https://hive.example/api/workflows/ingest/cluster \
-H "Authorization: Bearer $HIVE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"context": "ci-cluster", "namespace": "ci",
"repository": "example-org/example-app", "save": true}'
The response has the same fields as a repository ingest (model, compiled, diagnostics,
profile, files, pipelines, entry) plus:
source:cluster:<context>/<namespace>(current-contextand*stand in for an empty context and all namespaces);runs[]: the last observed run per pipeline, as{pipeline, namespace, run, status, completed}, wherestatusisSucceeded,Running,Unknownor the Tekton reason (Failed,Cancelled, …);namespaces[]: the namespaces read.
Errors:
| Status | Cause |
|---|---|
400 | No namespace and no allNamespaces |
403 | RBAC denied a list |
404 | The context is not in the kubeconfig |
413 | A cap was exceeded: more than 500 objects after run trimming, or more than 8 MiB of YAML |
422 | Tekton is not installed (no pipelines.tekton.dev), or the hive has no kubectl or kubeconfig |
Each kubectl call times out after 60 seconds.
Runs are observations
PipelineRuns never become lifecycle states. The last run per pipeline is returned in runs[],
recorded on the model as an annotation workflow.hivecommons.dev/observed-run/<pipeline id>,
and listed as an observed-run-status finding, so a reviewer can see “this pipeline last
succeeded” without the model inferring anything from it. Older runs beyond runsPerPipeline
are dropped and reported as runs-trimmed.
How Tekton maps into the model
A Pipeline resource, or a PipelineRun with an embedded pipelineSpec, becomes one entry in
spec.pipelines:
| Tekton | Model field |
|---|---|
| file path | path; the id is tkn- plus a slug of the path, with the resource name added when one file holds several pipelines |
metadata.name (or generateName without the trailing -) | name |
each entry of spec.tasks | a node, kind: task |
each entry of spec.finally | a node, kind: finally, that needs every task |
runAfter | the node’s needs: these are the DAG’s edges |
$(tasks.<name>.…) references in params, when, workspaces or matrix | extra needs, since Tekton orders those tasks too |
taskRef.name, a resolver reference, or an inline taskSpec | ref (the name; <resolver>:<name, url or pathInRepo>; or inline) |
when expressions | when, as <input> <operator> [values] or cel: <expression> |
matrix | matrix summary (parameter names, include count, dynamic) |
A runAfter that names no task is dropped and reported as runafter-unresolved; an edge that
would close a cycle is dropped and reported as runafter-cycle.
Triggers and roles
A Tekton Pipeline has no trigger of its own. Ingest finds triggers in:
- Pipelines-as-Code annotations on a
PipelineRunthat embeds the pipeline or references it by name:pipelinesascode.tekton.dev/on-event,on-target-branch,on-path-change, and thepipelinesascode.tekton.dev/event-typelabel. Anon-cel-expressionis recorded as aceltrigger; when it containsevent == "pull_request"orevent == "push", that event is added as well. - Tekton Triggers: a
TriggerTemplatewhose resource template is aPipelineRunnaming the pipeline adds awebhooktrigger.
The role then decides where the pipeline binds:
| Triggers | Role | Where it binds |
|---|---|---|
any pull_request | pr-verify | Every state in the CI / Review column |
push to a tag-looking branch (refs/tags/... or a v* pattern) | release | A Release column after Merged |
push | push-verify | A Main CI column after Merged |
incoming | manual | Listed, not bound to a state |
anything else, including only webhook | other | Listed, not bound to a state |
A pipeline used by both pull-request and push runs binds to CI / Review and to Main CI. A
pipeline with no trigger in the ingested files is reported as no-trigger and binds to no
state: a bare Pipeline library file needs the PipelineRuns that use it in the same ingest.
On a cluster, that means runs created by Pipelines-as-Code (which carry its annotations) or a
TriggerTemplate.
Other findings you may see: task-definitions (Task, ClusterTask, StepAction or TaskRun
documents, which are not pipelines), tekton-triggers (Triggers resources are noted, not
modelled), pipelineref-external (a PipelineRun names a pipeline not in the ingested files),
finally, taskref-bundle (deprecated bundle references), custom-task, on-error,
pipeline-resources and duplicate-task.
What is and is not executed
| Done by | |
|---|---|
| Creating and running PipelineRuns, TaskRuns, workspaces, results | Tekton (and Pipelines-as-Code or Tekton Triggers), unchanged |
| Reading Tekton definitions and building the DAG | Hive, at ingest time only |
| Reporting the last run per pipeline | Hive, at cluster ingest time only, as an annotation |
| Deriving an item’s lifecycle state | Hive, from facts it observes (checks, reviews, labels), once the model is bound and derivation is on |
| Moving merged PRs through Main CI and Release | Not yet: live derivation reports pipeline.status as unknown for Tekton pipelines, so these columns render but stay empty |
Where Pipelines-as-Code reports pull-request runs back to GitHub as checks, hive’s CI / Review derivation sees them the way it sees any other check on the pull request’s head.
How it shows in the dashboard
The same places as a GitHub Actions ingest: the Ingest view’s result block (plus Observed runs for a cluster), the Library and model detail with the diagram, citations and raw JSON, the editor, and, once bound on Settings → Repos, the Activity Monitor’s columns.
Worked example
.tekton/build-pipeline.yaml clones, runs unit tests and lint in parallel, builds an image, and
always reports:
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: build
spec:
tasks:
- name: clone
taskRef:
name: git-clone
- name: unit-test
runAfter: [clone]
taskRef:
name: go-test
- name: lint
runAfter: [clone]
taskRef:
name: golangci-lint
- name: build-image
runAfter: [unit-test, lint]
taskRef:
name: buildah
params:
- name: CONTEXT
value: $(tasks.clone.results.path)
finally:
- name: report
taskRef:
name: report-status
.tekton/build-pull-request.yaml and .tekton/build-push.yaml are the Pipelines-as-Code runs
that use it:
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: build-on-pull-request
annotations:
pipelinesascode.tekton.dev/on-event: "[pull_request]"
pipelinesascode.tekton.dev/on-target-branch: "[main]"
spec:
pipelineRef:
name: build
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: build-on-push
annotations:
pipelinesascode.tekton.dev/on-event: "[push]"
pipelinesascode.tekton.dev/on-target-branch: "[main]"
spec:
pipelineRef:
name: build
Ingesting the three files gives one pipeline with four levels. build-image needs clone as
well as its runAfter entries, because its params read clone’s result; report is a
finally node that needs every task.
{
"id": "tkn-tekton-build-pipeline",
"name": "build",
"system": "tekton",
"path": ".tekton/build-pipeline.yaml",
"role": "pr-verify",
"triggers": [
{ "event": "pull_request", "branches": ["main"] },
{ "event": "push", "branches": ["main"] }
],
"nodes": [
{ "id": "clone", "name": "clone", "kind": "task", "ref": "git-clone", "level": 0 },
{ "id": "unit-test", "name": "unit-test", "kind": "task", "needs": ["clone"], "ref": "go-test", "level": 1 },
{ "id": "lint", "name": "lint", "kind": "task", "needs": ["clone"], "ref": "golangci-lint", "level": 1 },
{ "id": "build-image", "name": "build-image", "kind": "task", "needs": ["clone", "lint", "unit-test"], "ref": "buildah", "level": 2 },
{ "id": "report", "name": "report", "kind": "finally", "needs": ["clone", "unit-test", "lint", "build-image"], "ref": "report-status", "level": 3 }
],
"levels": 4
}
The pull_request run makes the pipeline pr-verify, so it is bound to every CI / Review
state with a citation to .tekton/build-pipeline.yaml. The push run also binds it to a Main
CI column after Merged, followed by Done:
[
{ "id": "main-ci", "label": "Main CI", "hint": "Runs after merge: tkn-tekton-build-pipeline", "states": ["main-ci"] },
{ "id": "done", "label": "Done", "hint": "Every post-merge pipeline has run", "states": ["done"], "terminal": true }
]
spec.meta.source is tekton, and spec.coverage.findings carries one finally warning for
the pipeline file. Ingesting the same Pipeline from a cluster gives the same DAG, with paths
such as cluster/ci/pipeline/build.yaml.
Import as a task workflow draft
A Tekton Pipeline, or a PipelineRun with an embedded pipelineSpec, can also be converted
into a DAG workflow (task workflow) draft, with the same call, limits and
guarantees as for GitHub Actions: see
Import as a task workflow draft.
The draft has no agents, prompts, schedule or notification target, is stored only disabled,
and nothing in the files is executed or fetched (no task, no resolver, no bundle).
jq -n --rawfile p .tekton/build-pipeline.yaml \
'{files: {".tekton/build-pipeline.yaml": $p}, system: "tekton", pipeline: "build"}' |
curl -s -X POST https://hive.example/api/task-workflows/import \
-H "Authorization: Bearer $HIVE_TOKEN" \
-H "Content-Type: application/json" \
-d @-
What maps
| Tekton | Task workflow draft |
|---|---|
each entry of spec.tasks, then spec.finally | a step with the task’s name (sanitised) |
runAfter, and $(tasks.<name>.…) references in params, when, workspaces or matrix | depends_on |
a finally task | a step that depends on every other step (see finally-not-guaranteed below) |
retries: N | retry.max_attempts: N+1, at most 10 |
timeout: | the step’s timeout, kept within 1m to 24h |
spec.params (string) | spec.params; a param with no default is required |
What does not map
Findings have the same shape as for GitHub Actions. Tekton-specific codes:
| Code | Construct | What the draft does instead |
|---|---|---|
finally-not-guaranteed | finally | The step runs only if every other step succeeded; Tekton runs it whatever the outcome. Task workflows have no “run after completion” dependency |
when-expression | when | The step runs whenever its dependencies succeed |
results | pipeline results, and a task reading $(tasks.<name>.results.<r>) | The ordering is kept; the value is not. Use {{steps.<id>.result}} in the prompt |
workspaces | pipeline and task workspaces | Steps share nothing but their reported results |
matrix | matrix | One step, run once |
on-error | onError | Nothing; set on_failure on the step |
remote-task-ref | a resolver or bundle taskRef | Noted; it is not fetched |
custom-task | a taskRef to a non-Tekton apiVersion | Nothing |
step-commands-not-carried | the task’s taskRef or inline taskSpec steps | Nothing; write the step’s prompt |
secret-reference | secretKeyRef, secretRef and secret workspace bindings, in the pipeline and in the file’s PipelineRuns and Tasks | Nothing; the finding carries <secret:NAME> |
secret-resource | a Secret document in the file | Skipped; its values are not carried |
secret-default-dropped | a param whose name or default looks like a credential | The default is not carried; the param becomes required |
param-type | an array or object param | A text param without the default |
dependency-dropped | a runAfter to an unknown task, a cycle, a duplicate task | The edge or task is dropped |
triggers-not-carried | Pipelines-as-Code annotations and Tekton Triggers that start the pipeline | Nothing; add spec.schedule or start runs from the API |
run-params-not-carried | a PipelineRun’s params values | Nothing; pass them when starting a run |
tekton-triggers, pipeline-resources, task-definitions, pipelineref-external | Triggers resources, PipelineResources, Task documents, a PipelineRun naming a pipeline not in the files | Reported per file; not carried |
retries, timeout | retries of 10 or more, a timeout outside 1m to 24h | Capped or moved into the range |
incomplete-source | a task whose definition could not be matched | Its settings were not checked |
The GitHub Actions guide lists the codes both systems share (id-renamed, param-renamed,
param-default-clipped, file-level findings and limits).
Next steps
- Review the draft in the editor, confirm the inferred states, then bind it on Settings → Repos.
- Use Simulate on the model’s detail page to check where real issues and PRs would land.
- To hand states to agents, add agent grants; see Workflow models and Agent configuration.
- To have hive run the same DAG on its own agents, import it as a task workflow draft and complete it, or author it natively as a DAG workflow.