openshift-pipelines / pipelines-as-code

Pipelines-as-Code for Tekton
https://pipelinesascode.com
Apache License 2.0
138 stars 84 forks source link

Pipelines-in-Pipelines support #1354

Open Bibz87 opened 1 year ago

Bibz87 commented 1 year ago

Are Pipelines-in-Pipelines supported?

I've installed the PiP controller and regular runs made directly in Tekton work properly. However, trying to run with Pipelines as Code makes PaC think the sub-pipeline is a task and can't find it.

I'm using Pipelines as Code's stable version.

Error: ``` json { "severity": "ERROR", "timestamp": "2023-07-25T20:23:18.321536113Z", "logger": "pipelinesascode", "caller": "events/emit.go:45", "message": "failed to match pipelineRuns: cannot find referenced task good-morning-good-afternoon. if it's a remote task make sure to add it in the annotations", "commit": "88586a0", "provider": "gitlab", "event-id": "", "event-sha": "e22167794157a14fb6be28cf793cf31c4f8d05f4", "event-type": "Push", "stacktrace": "github.com/openshift-pipelines/pipelines-as-code/pkg/events.(*EventEmitter).EmitMessage\n\t/src/pkg/events/emit.go:45\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).getPipelineRunsFromRepo\n\t/src/pkg/pipelineascode/match.go:162\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).matchRepoPR\n\t/src/pkg/pipelineascode/match.go:34\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/pipelineascode.(*PacRun).Run\n\t/src/pkg/pipelineascode/pipelineascode.go:47\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.(*sinker).processEvent\n\t/src/pkg/adapter/sinker.go:52\ngithub.com/openshift-pipelines/pipelines-as-code/pkg/adapter.listener.handleEvent.func1.2\n\t/src/pkg/adapter/adapter.go:189" } ```
Configuration: ## Sub-pipeline This pipeline is installed directly on the cluster and is listed in Tekton Dashboard's `Pipelines` section. The same error also occurs if the pipeline is remotely referenced via an annotation. ``` yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: good-morning-good-afternoon spec: tasks: - name: echo-good-morning taskSpec: steps: - name: echo image: ubuntu script: | #!/usr/bin/env bash echo "Good Morning!" - name: echo-good-afternoon taskSpec: steps: - name: echo image: ubuntu script: | #!/usr/bin/env bash echo "Good Afternoon!" ``` ## PipelineRun ``` yaml apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: test-pipeline-in-pipeline annotations: pipelinesascode.tekton.dev/max-keep-runs: "5" pipelinesascode.tekton.dev/on-cel-expression: > event == "push" spec: serviceAccountName: 'default' pipelineSpec: name: test-pipeline-in-pipeline description: Testing Pipelines-in-Pipelines feature tasks: - name: hello taskSpec: steps: - name: echo image: ubuntu script: | #!/usr/bin/env bash echo "Hello World!" - name: greeting taskRef: apiVersion: tekton.dev/v1beta1 kind: Pipeline name: good-morning-good-afternoon runAfter: - hello - name: bye taskSpec: steps: - name: echo image: ubuntu script: | #!/usr/bin/env bash echo "Bye World!" runAfter: - greeting ```
Bibz87 commented 1 year ago

Come to think of it, Pipelines as Code only supports one pipeline on remote resolution, so even if Pipelines-in-Pipelines were supported, I'd still be forced to install multiple pipelines on the cluster. 🤔