-
Notifications
You must be signed in to change notification settings - Fork 39
chore(runner): First cut on Tekton pipeline detection #2581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
migmartri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ptal at the test error, and the spurious descriptor.ts
So in the end we have access to env vars and dashboards or am I understanding this incorrectly? Do you have a demo of the env?
| func (r *TektonPipeline) ListEnvVars() []*EnvVarDefinition { | ||
| return []*EnvVarDefinition{ | ||
| // PipelineRun context (optional - only present when running in a Pipeline) | ||
| {"TEKTON_PIPELINE_RUN", true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so these env vars are available then?
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tekton doesn't add labels through downward API, so it might be good to use the service account directly.
|
|
||
| const ( | ||
| // Default path for Downward API labels | ||
| defaultLabelsPath = "/etc/podinfo/labels" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The downward api is /tekton/downward and tekton only exposes annotations and not labels.
This PR adds automatic detection and metadata collection for Tekton Pipelines CI/CD environment.
Changes
TEKTON_PIPELINErunner type to the protobuf schema/tekton/resultsdirectoryDetection Strategy
The Tekton runner detects execution environments by checking for the presence of Tekton's
/tekton/resultsdirectory, which is mounted in all TaskRun and PipelineRun containers. This approach works reliably for both standalone TaskRuns and tasks within Pipelines.Metadata Collection via Kubernetes Downward API
The runner collects Tekton execution metadata by reading pod labels from the Kubernetes Downward API mounted at
/etc/podinfo/labels. Users must configure the Downward API volume mount in their Task/Pipeline definitions:Tekton Labels Collected
The runner reads the following Tekton-specific labels from pod metadata:
PipelineRun context:
TaskRun context:
Namespace: Automatically read from /var/run/secrets/kubernetes.io/serviceaccount/namespace
Run URI Construction
The runner constructs dashboard URLs with priority: PipelineRun URL > TaskRun URL, defaulting to https://dashboard.tekton.dev. Users can customize the dashboard URL by setting the TEKTON_DASHBOARD_URL environment variable.
The runner works in minimal mode with just filesystem detection when Downward API is not configured. Pod labels are only collected when the volume mount is present, allowing basic runner detection without requiring template modifications.
Tackles issue #2545