Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StepAction] taskSpec.results in Pipeline not works with workspaces #7754

Closed
uqix opened this issue Mar 14, 2024 · 5 comments
Closed

[StepAction] taskSpec.results in Pipeline not works with workspaces #7754

uqix opened this issue Mar 14, 2024 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@uqix
Copy link

uqix commented Mar 14, 2024

Expected Behavior

taskSpec.results in Pipeline works with workspaces and StepAction.

Actual Behavior

taskSpec.results in Pipeline not works with workspaces.

image

No results generated.

Steps to Reproduce the Problem

  1. pipeline.yaml
apiVersion: tekton.dev/v1
kind: Pipeline

metadata:
  name: build-module-nodejs-frontend-v1-sadev2
  labels:
    kustomize.toolkit.fluxcd.io/substitute: disabled
    app.kubernetes.io/version: "1.0.5"

spec:
  workspaces:
    - name: ws

  params:
    - name: value

  tasks:
    - name: main
      workspaces:
        - name: ws
      taskSpec:
        workspaces:
          - name: ws
        results:
          - name: build-ts
            value: $(steps.build-ts.results.value)
        steps:
          - name: build-ts
            ref:
              name: build-ts-v1.2
  1. stepaction.yaml
apiVersion: tekton.dev/v1alpha1
kind: StepAction

metadata:
  name: build-ts-v1.2
  labels:
    kustomize.toolkit.fluxcd.io/substitute: disabled
    app.kubernetes.io/version: "1.0.0"

spec:
  results:
    - name: value

  image: bash:5.2.15

  script: |
    #!/usr/bin/env bash

    echo -n "abc" | tee "$(step.results.value.path)"

    # </bash>
  1. pipelinerun.yaml
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: build-module-nodejs-frontend-v1-dev2-
  labels:
    tekton/concurrency-group: build-module-nodejs-frontend-v1-dev
    tekton/run-group: build-module-nodejs-frontend-v1-dev

spec:
  workspaces:
    - name: ws
      emptyDir: {}

  pipelineRef:
    name: build-module-nodejs-frontend-v1-sadev2
  params:
    - name: value
      value: yyy

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.6", GitCommit:"741c8db18a52787d734cbe4795f0b4ad860906d6", GitTreeState:"clean", BuildDate:"2023-09-13T09:21:34Z", GoVersion:"go1.20.8", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.6", GitCommit:"741c8db18a52787d734cbe4795f0b4ad860906d6", GitTreeState:"clean", BuildDate:"2023-09-13T09:14:09Z", GoVersion:"go1.20.8", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

v0.57.0
@uqix uqix added the kind/bug Categorizes issue or PR as related to a bug. label Mar 14, 2024
@uqix
Copy link
Author

uqix commented Mar 14, 2024

It works if workspaces commented out:

pipeline.yaml

apiVersion: tekton.dev/v1
kind: Pipeline

metadata:
  name: build-module-nodejs-frontend-v1-sadev2
  labels:
    kustomize.toolkit.fluxcd.io/substitute: disabled
    app.kubernetes.io/version: "1.0.5"

spec:
  # workspaces:
  #   - name: ws

  params:
    - name: value

  tasks:
    - name: main
      # workspaces:
      #   - name: ws
      taskSpec:
        # workspaces:
        #   - name: ws
        results:
          - name: build-ts
            value: $(steps.build-ts.results.value)
        steps:
          - name: build-ts
            ref:
              name: build-ts-v1.2

pipelinerun.yaml

apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: build-module-nodejs-frontend-v1-dev2-
  labels:
    tekton/concurrency-group: build-module-nodejs-frontend-v1-dev
    tekton/run-group: build-module-nodejs-frontend-v1-dev

spec:
  # workspaces:
  #   - name: ws
  #     emptyDir: {}

  pipelineRef:
    name: build-module-nodejs-frontend-v1-sadev2
  params:
    - name: value
      value: yyy
image

@chitrangpatel
Copy link
Member

Thanks for filing this bug @uqix

The issue is the use of an emptyDir which inturn is added to the Step template and when merging Step with StepTemplate, we lose the Step's Results and Params.

It's a quick fix that I will send in very shortly.

@uqix
Copy link
Author

uqix commented Mar 15, 2024

Thanks, BTW, volumeClaimTemplate workspace also has this issue.

chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue Mar 15, 2024
Prior to this, when we merged StepTemplate with the Spec, we would
lose the Results and Params because the merged Step would overwrite
the original Step. This PR adds the Results and Params when creating
the new Step so that we don't lose this information.

It fixes Issue tektoncd#7754

Signed-off-by: Chitrang Patel <chitrang@google.com>
@chitrangpatel
Copy link
Member

Fix in #7757

tekton-robot pushed a commit that referenced this issue Mar 26, 2024
Prior to this, when we merged StepTemplate with the Spec, we would
lose the Results and Params because the merged Step would overwrite
the original Step. This PR adds the Results and Params when creating
the new Step so that we don't lose this information.

It fixes Issue #7754

Signed-off-by: Chitrang Patel <chitrang@google.com>
@chitrangpatel
Copy link
Member

Fixed.

tekton-robot pushed a commit to tekton-robot/pipeline that referenced this issue Mar 27, 2024
Prior to this, when we merged StepTemplate with the Spec, we would
lose the Results and Params because the merged Step would overwrite
the original Step. This PR adds the Results and Params when creating
the new Step so that we don't lose this information.

It fixes Issue tektoncd#7754

Signed-off-by: Chitrang Patel <chitrang@google.com>
tekton-robot pushed a commit that referenced this issue Mar 27, 2024
Prior to this, when we merged StepTemplate with the Spec, we would
lose the Results and Params because the merged Step would overwrite
the original Step. This PR adds the Results and Params when creating
the new Step so that we don't lose this information.

It fixes Issue #7754

Signed-off-by: Chitrang Patel <chitrang@google.com>
l-qing pushed a commit to katanomi/pipeline that referenced this issue Apr 29, 2024
Prior to this, when we merged StepTemplate with the Spec, we would
lose the Results and Params because the merged Step would overwrite
the original Step. This PR adds the Results and Params when creating
the new Step so that we don't lose this information.

It fixes Issue tektoncd#7754

Signed-off-by: Chitrang Patel <chitrang@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants