tektoncd / tektoncd/pipelines-as-code

Pipelines-in-Pipelines support

Open
#1,354 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority/low
Dominant language
Go
Stars
214
Forks
144
Avg merge
2d 11h
Merged PRs (30d)
27

Description

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:
{
  "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.

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

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the matching path in pkg/pipelineascode/match.go and the error emission in pkg/events/emit.go, then reproduce the supplied PipelineRun and Pipelines-in-Pipelines configuration with the GitLab push event. Trace why the Pipeline taskRef is treated as a task; done means establishing whether PaC recognizes the sub-pipeline and defining the resulting supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
gitlab, go, kubernetes
Domain
ci-cd, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.