kuberneteskubectlcicdtektontekton-pipelines

Retrieve status of triggered pipeline using an API in Tekton


When we perform Tekton trigger API using an eventlistener, I am getting following response while in the background, pipeline runs for certain period of time.

Is there any API to fetch the status of this pipelineRun using the given eventID or eventListenerUID?

{
  "eventListener": "listener",
  "namespace": "default",
  "eventListenerUID": "ea71a6e4-9531-43a1-94fe-6136515d938c",
  "eventID": "14a657c3-6816-45bf-b214-4afdaefc4ebd"
}

Ref - https://github.com/tektoncd/triggers/blob/main/docs/eventlisteners.md#labels-in-eventListeners


Solution

  • You can use that eventID resolving your pipelinerun:

    kubectl -n <your-namespace> get pr -l triggers.tekton.dev/tekton-eventid=<your-event-id>
    

    Then, extract the status column, or use jsonpath to access status.conditions[0].type.