tektoncd/pipeline

Pipelinerun should be able to read from Secret and Configmap

Open

#8,347 opened on Oct 28, 2024

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Go (1,943 forks)auto 404
area/apihelp wantedkind/api-changekind/feature

Repository metrics

Stars
 (9,013 stars)
PR merge metrics
 (PR metrics pending)

Description

I want to reopen the following Feature Request: https://github.com/tektoncd/pipeline/issues/2688

Feature request

We are using a current version of Openshift/Tekton

Openshift/Kubernetes: Client Version: 4.16.13 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: 4.16.13 Kubernetes Version: v1.29.8+f10c92d Openshift Version: 4.16.13

Tekton: Client version: 0.37.0 Chains version: v0.22.2 Pipeline version: v0.62.3 Triggers version: v0.29.1 Operator version: v0.73.1 Openshift Operator: 1.16.0

I'am looking for a feature to read Pipelinerun Parameters from a Configmap and Secret. I know it is possible within a task to read Settings from Secrets and Configmaps into a Environment Variable, but this is no option when using Openshift ClusterTasks.

Use case

In my Case i am using "buildah" ClusterTask which expects the Variable "IMAGE" for the image to build, since i am using an external Image Registry the Name must include the Hostname in order the image can be pushed, so it should be in a dynamic form. Example Pipeline:

apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: imagebuilder
spec:
  description: "build image based on dockerfile"
...
  tasks:
  - name: buildah
    timeout: "0h15m00s"
    params:
      name: IMAGE
      value: "<myserver>:<port>/$(context.pipelineRun.namespace)/myimage:latest"
...

I need a "Variable" that represents my ":" value. I can use some workarrounds like Including the Servername in the Webhook Payload, create a previous tasks that reads the Secret/Configmap Value and set's a Task Result Variable which can be used in buildah value Parameter, but all of them are not satisfying.

I am not sure where would be the right place to read the Secret/Configmap value, for me it would be ok if i could do it in the Pipelinerun definition like:

...
  resourcetemplates:
  - apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
    metadata:
      generateName: run-build-
    spec:
      serviceAccountName: pipeline
      pipelineRef:
        name: build
      params:
      - name: dockerregistry
        valueFrom:
          secretKeyRef:
            name: <mysecret>
            key: <mykey>
...

Contributor guide