Observability in OpenShift Pipelines Red Hat OpenShift Pipelines 1.18 Observability features of OpenShift Pipelines Red Hat OpenShift Documentation Team

Commands:
results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed
results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/e9c736db-5665-441f-922f-7c1d65c9d621
oc get pipelinerun <cr_name> -o yaml
kind: PipelineRun spec: params: - name: message value: five timeouts: pipeline: 1h0m0s pipelineRef: name: echo-pipeline taskRunTemplate: serviceAccountName: pipeline status: startTime: "2023-08-07T11:41:40Z" conditions: - type: Succeeded reason: Succeeded status: "True" message: 'Tasks Completed: 1 (Failed: 0, Cancelled 0), Skipped: 0' lastTransitionTime: "2023-08-07T11:41:49Z" pipelineSpec: tasks: - name: echo-task params: - name: message value: five taskRef: kind: Task name: echo-task-pipeline params: - name: message type: string completionTime: "2023-08-07T11:41:49Z" childReferences: - kind: TaskRun name: echo-pipeline-run-gmzrx-echo-task apiVersion: tekton.dev/v1 pipelineTaskName: echo-task metadata: uid: 62c3b02e-f12b-416c-9771-c02af518f6d4 name: echo-pipeline-run-gmzrx labels: tekton.dev/pipeline: echo-pipeline namespace: releasetest-js5tt finalizers: - chains.tekton.dev/pipelinerun generation: 2 annotations: results.tekton.dev/log: releasetest-js5tt/results/62c3b02e-f12b-416c-9771-c02af518f6d4/logs/c1e49dd8-d641-383e-b708-e3a02b6a4378 chains.tekton.dev/signed: "true" results.tekton.dev/record: releasetest-js5tt/results/62c3b02e-f12b-416c-9771-c02af518f6d4/records/62c3b02e-f12b-416c-9771-c02af518f6d4 results.tekton.dev/result: releasetest-js5tt/results/62c3b02e-f12b-416c-9771-c02af518f6d4 generateName: echo-pipeline-run- managedFields: - time: "2023-08-07T11:41:39Z" manager: kubectl-create fieldsV1: f:spec: .: {} f:params: {} f:pipelineRef: .: {} f:name: {} f:metadata: f:generateName: {} operation: Update apiVersion: tekton.dev/v1 fieldsType: FieldsV1 - time: "2023-08-07T11:41:40Z" manager: openshift-pipelines-controller fieldsV1: f:metadata: f:labels: .: {} f:tekton.dev/pipeline: {} operation: Update apiVersion: tekton.dev/v1 fieldsType: FieldsV1 - time: "2023-08-07T11:41:49Z" manager: openshift-pipelines-chains-controller fieldsV1: f:metadata: f:finalizers: .: {} v:"chains.tekton.dev/pipelinerun": {} f:annotations: .: {} f:chains.tekton.dev/signed: {} operation: Update apiVersion: tekton.dev/v1 fieldsType: FieldsV1 - time: "2023-08-07T11:41:49Z" manager: openshift-pipelines-controller fieldsV1: f:status: f:startTime: {} f:conditions: {} f:pipelineSpec: .: {} f:tasks: {} f:params: {} f:completionTime: {} f:childReferences: {} operation: Update apiVersion: tekton.dev/v1 fieldsType: FieldsV1 subresource: status - time: "2023-08-07T11:42:15Z" manager: openshift-pipelines-results-watcher fieldsV1: f:metadata: f:annotations: f:results.tekton.dev/log: {} f:results.tekton.dev/record: {} f:results.tekton.dev/result: {} operation: Update apiVersion: tekton.dev/v1 fieldsType: FieldsV1 resourceVersion: "126429" creationTimestamp: "2023-08-07T11:41:39Z" deletionTimestamp: "2023-08-07T11:42:23Z" deletionGracePeriodSeconds: 0 apiVersion: tekton.dev/v1
apiVersion: observability.openshift.io/v1 kind: ClusterLogForwarder metadata: name: collector namespace: openshift-logging spec: inputs: - application: selector: matchExpressions: - key: app.kubernetes.io/managed-by operator: In values: ["tekton-pipelines", "pipelinesascode.tekton.dev"] name: only-tekton type: application managementState: Managed outputs: - lokiStack: labelKeys: application: ignoreGlobal: true labelKeys: - log_type - kubernetes.namespace_name - openshift_cluster_id authentication: token: from: serviceAccount target: name: logging-loki namespace: openshift-logging name: default-lokistack tls: ca: configMapName: openshift-service-ca.crt key: service-ca.crt type: lokiStack pipelines: - inputRefs: - only-tekton name: default-logstore outputRefs: - default-lokistack serviceAccount: name: collector
apiVersion: "logging.openshift.io/v1" kind: ClusterLogForwarder metadata: name: instance namespace: openshift-logging spec: inputs: - name: only-tekton application: selector: matchLabels: app.kubernetes.io/managed-by: tekton-pipelines pipelines: - name: enable-default-log-store inputRefs: [ only-tekton ] outputRefs: [ default ]
oc apply -n openshift-logging ClusterLogForwarder.yaml
oc edit TektonConfig config
apiVersion: operator.tekton.dev/v1alpha1 kind: TektonConfig metadata: name: config spec: result: loki_stack_name: logging-loki 1 loki_stack_namespace: openshift-logging 2
oc create secret generic tekton-results-postgres --namespace=openshift-pipelines --from-literal=POSTGRES_USER=<user> --from-literal=POSTGRES_PASSWORD=<password>
oc edit TektonConfig config
apiVersion: operator.tekton.dev/v1alpha1 kind: TektonConfig metadata: name: config spec: result: is_external_db: true db_host: database.example.com 1 db_port: 5342 2
oc edit TektonConfig config
apiVersion: operator.tekton.dev/v1alpha1 kind: TektonConfig metadata: name: config spec: result: options: configMaps: config-results-retention-policy: data: runAt: "3 5 * * 0" 1 maxRetention: "30" 2
export RESULTS_API=USD(oc get route tekton-results-api-service -n openshift-pipelines --no-headers -o custom-columns=":spec.host"):443
oc create token <service_account>
address: <tekton_results_route> 1 token: <authentication_token> 2 ssl: roots_file_path: /home/example/cert.pem 3 server_name_override: tekton-results-api-service.openshift-pipelines.svc.cluster.local 4 service_account: namespace: service_acc_1 5 name: service_acc_1 6
opc results list --addr USD{RESULTS_API} <namespace_name>
opc results list --addr USD{RESULTS_API} results-testing
Name Start Update results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed 2023-06-29 02:49:53 +0530 IST 2023-06-29 02:50:05 +0530 IST results-testing/results/ad7eb937-90cc-4510-8380-defe51ad793f 2023-06-29 02:49:38 +0530 IST 2023-06-29 02:50:06 +0530 IST results-testing/results/d064ce6e-d851-4b4e-8db4-7605a23671e4 2023-06-29 02:49:45 +0530 IST 2023-06-29 02:49:56 +0530 IST
opc results records list --addr USD{RESULTS_API} <result_name>
opc results records list --addr USD{RESULTS_API} results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed
Name Type Start Update results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/e9c736db-5665-441f-922f-7c1d65c9d621 tekton.dev/v1.TaskRun 2023-06-29 02:49:53 +0530 IST 2023-06-29 02:49:57 +0530 IST results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/5de23a76-a12b-3a72-8a6a-4f15a3110a3e results.tekton.dev/v1alpha2.Log 2023-06-29 02:49:57 +0530 IST 2023-06-29 02:49:57 +0530 IST results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/57ce92f9-9bf8-3a0a-aefb-dc20c3e2862d results.tekton.dev/v1alpha2.Log 2023-06-29 02:50:05 +0530 IST 2023-06-29 02:50:05 +0530 IST results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/e9a0c21a-f826-42ab-a9d7-a03bcefed4fd tekton.dev/v1.TaskRun 2023-06-29 02:49:57 +0530 IST 2023-06-29 02:50:05 +0530 IST results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/04e2fbf2-8653-405f-bc42-a262bcf02bed tekton.dev/v1.PipelineRun 2023-06-29 02:49:53 +0530 IST 2023-06-29 02:50:05 +0530 IST results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/e6eea2f9-ec80-388c-9982-74a018a548e4 results.tekton.dev/v1alpha2.Log 2023-06-29 02:50:05 +0530 IST 2023-06-29 02:50:05 +0530 IST
opc results records get --addr USD{RESULTS_API} <record_name> | jq -r .data.value | base64 -d | xargs -0 python3 -c 'import sys, yaml, json; j=json.loads(sys.argv[1]); print(yaml.safe_dump(j))'
opc results records get --addr USD{RESULTS_API} results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/records/e9c736db-5665-441f-922f-7c1d65c9d621 | jq -r .data.value | base64 -d | xargs -0 python3 -c 'import sys, yaml, json; j=json.loads(sys.argv[1]); print(yaml.safe_dump(j))'
opc results logs get --addr USD{RESULTS_API} <log_record_name> | jq -r .data | base64 -d
opc results logs get --addr USD{RESULTS_API} results-testing/results/04e2fbf2-8653-405f-bc42-a262bcf02bed/logs/e9c736db-5665-441f-922f-7c1d65c9d621 | jq -r .data | base64 -d
opc results list --addr USD{RESULTS_API} --filter="<cel_query>" <namespace-name>
opc results records list --addr USD{RESULTS_API} --filter="<cel_query>" <namespace_name>/result/-
opc results records list --addr USD{RESULTS_API} --filter="<cel_query>" <result_name>