Stitch any CI into Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

provider/tekton: fix service account name location

Tekton v1beta1 PipelineRun objects[1] had the service account specified at
the top level of spec, eg:

```yaml
spec:
serviceAccountName: tack
```

However Tekton v1 PipelineRun objects have the service account inside a
`taskRunTemplate` object:

```yaml
spec:
taskRunTemplate:
serviceAccountName: tack
```

This change properly places the service account name in the right place
for Tekton v1 PipelineRun objects so that Tack can properly annotate CI
pipelines with the right service account.

[1]: https://tekton.dev/docs/pipelines/pipelineruns/#mapping-serviceaccount-credentials-to-tasks

Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso dc7fbbbe 2a4b67d4

+4 -2
+3 -1
provider_tekton.go
··· 368 368 } 369 369 370 370 if cfg.ServiceAccount != "" { 371 - spec["serviceAccountName"] = cfg.ServiceAccount 371 + spec["taskRunTemplate"] = map[string]any{ 372 + "serviceAccountName": cfg.ServiceAccount, 373 + } 372 374 } 373 375 374 376 // Merge user-defined params with the built-in ones (commit,
+1 -1
provider_tekton_test.go
··· 113 113 if !ok || pipeline != "repo-ci" { 114 114 t.Fatalf("pipelineRef.name = %q", pipeline) 115 115 } 116 - sa, ok := obj.NestedString("spec", "serviceAccountName") 116 + sa, ok := obj.NestedString("spec", "taskRunTemplate", "serviceAccountName") 117 117 if !ok || sa != "runner" { 118 118 t.Fatalf("serviceAccountName = %q", sa) 119 119 }