@@ -201,7 +201,7 @@ hello True Succeeded 11s
201201``` yaml
202202$ cat <<EOF | kubectl create -f -
203203apiVersion : rbac.authorization.k8s.io/v1
204- kind : Role
204+ kind : ClusterRole
205205metadata :
206206 name : tekton-results-readonly
207207rules :
@@ -241,7 +241,6 @@ apiVersion: rbac.authorization.k8s.io/v1
241241kind : ClusterRoleBinding
242242metadata :
243243 name : tekton-results-user
244- namespace : default
245244subjects :
246245 - kind : ServiceAccount
247246 name : impersonate-user
@@ -313,6 +312,9 @@ $ curl -s -k \
313312> [ tkn] ( https://github.com/tektoncd/cli/releases ) is a command-line tool for interacting with Tekton. You can download it from the [ official page] ( https://github.com/tektoncd/cli/releases ) .
314313>
315314> You need to build [ tkn-results] ( https://github.com/tektoncd/results/blob/main/cmd/tkn-results/main.go ) using golang.
315+ >
316+ > Do not always build from ` main ` . Use the release branch that matches the Tekton Results version deployed in your environment.
317+ > You can find the Results component version in [ Release Notes] ( ../overview/release_notes.mdx#compatibility-and-support-matrix ) (the ` Results ` column), and then checkout the corresponding branch ` release-v<version>.x ` .
316318
317319``` sh
318320# 1. Clone the repository
@@ -321,12 +323,25 @@ git clone https://github.com/tektoncd/results.git
321323# 2. Change to the project directory
322324cd results
323325
324- # 3. Build the binary
326+ # 3. Checkout the matching release branch (example: Results 0.15.x -> release-v0.15.x)
327+ git checkout release-v< version> .x
328+
329+ # 4. Build the binary
325330go build -o tkn-results ./cmd/tkn-results/main.go
326331
327- # 4 . Copy the binary to a directory in your PATH
332+ # 5 . Copy the binary to a directory in your PATH
328333```
329334
335+ ##### Connection behavior
336+
337+ > When ` --addr ` is not set, ` tkn-results ` attempts to auto port-forward to the Results API service.
338+ >
339+ > In many versions (including ` release-v0.15.x ` ), the auto target is ` tekton-pipelines/tekton-results-api-service ` .
340+ > If your Results deployment uses a different namespace or service name, auto mode may fail.
341+ >
342+ > When ` --addr ` is set, ` tkn-results ` connects to that address directly.
343+ > In that case, you typically need to run ` kubectl port-forward ` yourself.
344+
330345##### Querying the execution record list
331346
332347``` sh
@@ -336,6 +351,19 @@ default/results/209dcb81-e3c0-47cd-b082-d910e15702ae/records/209dcb81-e3c0-47cd-
336351default/results/209dcb81-e3c0-47cd-b082-d910e15702ae/records/a750035d-0479-34a1-9db2-9a256b53243f results.tekton.dev/v1alpha3.Log 2025-02-19 16:17:21 +0800 CST 2025-02-19 16:17:21 +0800 CST
337352```
338353
354+ ##### Fallback when auto port-forward fails
355+
356+ ``` sh
357+ $ kubectl port-forward -n < results-namespace> service/tekton-results-api-service 8080
358+
359+ $ tkn results --insecure --addr localhost:8080 records list default/results/-
360+ $ tkn results --insecure --addr localhost:8080 records get -o textproto default/results/< result-uid> /records/< record-uid>
361+ $ tkn results --insecure --addr localhost:8080 logs list default/results/-
362+ $ tkn results --insecure --addr localhost:8080 logs get -o textproto default/results/< result-uid> /logs/< log-uid>
363+ # If logs get returns "unknown service tekton.results.v1alpha3.Logs", retry with:
364+ $ tkn results --insecure --addr localhost:8080 --v1alpha2 logs get -o textproto default/results/< result-uid> /logs/< log-uid>
365+ ```
366+
339367##### Querying a single execution record
340368
341369``` sh
@@ -377,6 +405,9 @@ default/results/209dcb81-e3c0-47cd-b082-d910e15702ae/logs/a750035d-0479-34a1-9db
377405
378406##### Querying a single log
379407
408+ > The Logs API version may vary by deployment.
409+ > If you encounter ` unknown service tekton.results.v1alpha3.Logs ` , retry the command with the ` --v1alpha2 ` flag.
410+
380411``` sh
381412$ tkn results --insecure logs get -o textproto default/results/209dcb81-e3c0-47cd-b082-d910e15702ae/logs/a750035d-0479-34a1-9db2-9a256b53243f
382413
0 commit comments