Skip to content

Relative Task in remote Pipeline is resolved to the originating repository #2223

@jannekem

Description

@jannekem

Issue

Pipelines as Code attempts to resolve relative task references in remote pipelines from the originating repository of the event instead of the repository where the pipeline is defined.

There was an issue validating the commit: "error getting remote task from pipelinerun annotations: error getting remote task "./task.yaml": GET https://my-ghe.example/api/v3/repos/openshift/unittest-poc/contents/task.yaml?ref=bdc421ffbf34fc42f059c00e9a6def9fe2faf300: 404 Not Found []"

How to reproduce

The pipeline is configured as described in https://pipelinesascode.com/docs/guide/resolver/#relative-tasks

The openshift/unittest-poc repository in our GitHub Enterprise contains the following .tekton/hello-world.yaml:

---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: hello-world
  annotations:
    pipelinesascode.tekton.dev/on-event: "[push]"
    pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
    pipelinesascode.tekton.dev/max-keep-runs: "4"
    pipelinesascode.tekton.dev/pipeline: "https://my-ghe.example/openshift/tekton-catalog/blob/58a8304/pipeline.yaml"
spec:
  pipelineRef:
    name: hello-world

The openshift/tekton-catalog repository in our GitHub Enterprise has the following

pipeline.yaml:

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: hello-world
  annotations:
    pipelinesascode.tekton.dev/task: "./task.yaml"
spec:
  tasks:
    - name: say-hello
      taskRef:
        name: hello

task.yaml:

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello
spec:
  steps:
    - name: echo
      image: alpine
      script: |
        #!/bin/sh
        echo "Hello, World!"

We are running OpenShift Pipelines 1.19.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions