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

Task input "from" requires inputs to have the same name #1002

Closed
siamaksade opened this issue Jun 24, 2019 · 11 comments
Closed

Task input "from" requires inputs to have the same name #1002

siamaksade opened this issue Jun 24, 2019 · 11 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@siamaksade
Copy link

When providing the output of one task as an input to another task in a Pipeline, the source-copy step fails if the resource names are not the same. For example:

Task 1:

kind: Task
metadata:
  name: mvn-build
spec:
  inputs:
    resources:
    - name: build-source
      targetPath: /
      type: git
  outputs:
    resources:
    - name: build-source
      type: git

Task 2:

kind: Task
metadata:
  name: mvn-test
spec:
  inputs:
    resources:
    - name: test-source
      targetPath: /
      type: git

An the pipeline:

kind: Pipeline
metadata:
  name: build-pipeline
spec:
  resources:
  - name: app-git
    type: git
  tasks:
  - name: build
    taskRef:
      name: mvn-build
    resources:
      inputs:
      - name: build-source
        resource: app-git
      outputs:
      - name: build-source
        resource: app-git
  - name: test
    taskRef:
      name: mvn-test
    resources:
      inputs:
      - name: test-source
        resource: app-git
        from: [build]

Then the pipelinerun fails with

{"level":"error","ts":1561367722.1517646,"logger":"fallback-logger","caller":"bash/main.go:62","msg":"Error executing command \"cp -r /pvc/build/test-source/. /workspace\" with arguments cp: can't stat '/pvc/build/test-source/.': No such file or directory\n","stacktrace":"main.main\n\t/Users/ssadeghi/go/src/github.com/tektoncd/pipeline/cmd/bash/main.go:62\nruntime.main\n\t/usr/local/Cellar/go/1.12.6/libexec/src/runtime/proc.go:200"}

The git sources are copied to /pvc/build/build-source in the first task while the second task looks for them in /pvc/build/test-source.

This is particularly problematic when importing tasks that the user has not created themselves.

@vdemeester
Copy link
Member

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 24, 2019
@vdemeester vdemeester added this to the Pipelines 0.5 🐱 milestone Jun 24, 2019
@vdemeester
Copy link
Member

/kind bug

Indeed this is a bit problematic… We may need to be able to specify the name in the from like from: [ build as buildsource ? (for multiple this would be from: ["build as build-source", "test"] maybe ?)

/cc @bobcatfish @nader-ziada

@siamaksade
Copy link
Author

Can't this be transparent for the user?

@vdemeester
Copy link
Member

@siamaksade I don't really see how, as, if there is two resource of the same type in the from task, how can you choose the one you want ? (that is why I put the 2nd example, we may have a "default" behavior but… it seems very error prone)

@siamaksade
Copy link
Author

I see. There are then two related but different issues:

  1. When a task has multiple outputs of the same type, there should be way to specify the specific resource name to be used as the input of next task with from
  2. When output of one task is used as the input of next task, the resource should be made available at the path that the second task expects it

@vincent-pli
Copy link
Member

@siamaksade
I'm a little confuse, I think that's why the resource name in the next input section should be the same as resource name of previous output.
The stuff in the from point to task and the resource name point to previous resource which need.

@siamaksade
Copy link
Author

@vincent-pli the resource name is defined by the referenced Task, not the pipeline. User might have imported the tasks from tektoncd/catalog and have no control over how the resources are named.

@vincent-pli
Copy link
Member

@siamaksade How about adding alias for the previous output resource.

@nader-ziada
Copy link
Member

is there a reason why the input can't have the same name as the output? I feel like the easiest way is to keep the name the same and update the tasks accordingly. Otherwise @vdemeester suggestion of adding as buildsource would work, but just makes a little bit harder

@bobcatfish
Copy link
Collaborator

Quick update: assuming that #1279 and #238 will take care of this problem.

@bobcatfish
Copy link
Collaborator

Closing this in favor of #1673

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

6 participants