diff --git a/provider_tekton.go b/provider_tekton.go index d886f68..ce39c7c 100644 --- a/provider_tekton.go +++ b/provider_tekton.go @@ -368,7 +368,9 @@ func buildTektonPipelineRun( } if cfg.ServiceAccount != "" { - spec["serviceAccountName"] = cfg.ServiceAccount + spec["taskRunTemplate"] = map[string]any{ + "serviceAccountName": cfg.ServiceAccount, + } } // Merge user-defined params with the built-in ones (commit, diff --git a/provider_tekton_test.go b/provider_tekton_test.go index 2fbe56b..a4ccd67 100644 --- a/provider_tekton_test.go +++ b/provider_tekton_test.go @@ -113,7 +113,7 @@ func TestTektonBuildPipelineRun(t *testing.T) { if !ok || pipeline != "repo-ci" { t.Fatalf("pipelineRef.name = %q", pipeline) } - sa, ok := obj.NestedString("spec", "serviceAccountName") + sa, ok := obj.NestedString("spec", "taskRunTemplate", "serviceAccountName") if !ok || sa != "runner" { t.Fatalf("serviceAccountName = %q", sa) }