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

Missing substitution of propagated workspace in WorkingDirs #8008

Closed
chitrangpatel opened this issue May 30, 2024 · 0 comments · Fixed by #8016
Closed

Missing substitution of propagated workspace in WorkingDirs #8008

chitrangpatel opened this issue May 30, 2024 · 0 comments · Fixed by #8016
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@chitrangpatel
Copy link
Member

Expected Behavior

apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: ws-1
spec:
  workspaces:
  - name: "default-workspace"
    volumeClaimTemplate:
      spec:
        accessModes:
         - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
  pipelineSpec:
    tasks:
    - name: "write-sth"
      taskSpec:
        steps:
          - image: "ubuntu"
            script: |
              #!/bin/bash
              cd "$(workspaces.default-workspace.path)"
              mkdir -p backend/app
              ls -tlr
    - name: "get-it"
      taskSpec:
        steps:
          - image: "ubuntu"
            workingDir: $(workspaces.default-workspace.path)/backend/app
            script: |
              pwd
              echo done

The abovePipelineRun should run well and replace $(workspaces.default-workspace.path) with /workspace/default-workspace in the workingDir of the step because of workspace propagation.

Actual Behavior

The substitution is not applied and the container fails with the error message that the workingDir must be an absolute path. However, the same works in a Taskrun.

Steps to Reproduce the Problem

  1. Execute the above pipelinerun in any of the recent Tekton Pipelines releases.

Additional Info

  • Kubernetes version:

    Output of kubectl version:

(paste your output here)
  • 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}'

(paste your output here)
@chitrangpatel chitrangpatel added the kind/bug Categorizes issue or PR as related to a bug. label May 30, 2024
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes #8008.
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes #8008.
tekton-robot pushed a commit that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes #8008.
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue Jun 4, 2024
Fix: Identify workspace usage in a Task

Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit to tekton-robot/pipeline that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit that referenced this issue Jun 4, 2024
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes #8008.
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue Jun 5, 2024
Manual cherry-pick to avoid conflict with step-params.
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes tektoncd#8008.
tekton-robot pushed a commit that referenced this issue Jun 5, 2024
Manual cherry-pick to avoid conflict with step-params.
Prior to this, when identifying whether a Task used a workspace,
we limited the check to command, args and scripts in steps,
stepTemplates and sidecars. However, the workspace path could also
be used as a param to a StepAction or env cariables in steps and
sidecars and also workingDirs. This PR fixes that.

Fixes #8008.
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

Successfully merging a pull request may close this issue.

1 participant