Dubt on task input-output


#1

Hi,

I have read this very simple tutorial for deal with task input-output all work and all is fine. Now I’m trying to adapt to my pipeline, I try to realize this simple sequence:

  1. Clone my repo as resource A (OK)
  2. Execute inside task: npm install starting from A (OK)
  3. Output from last task the folder node_modules (I DON’T KNOW IF OK)
  4. Execute inside task: npm test starting from resource A and the input node_modules (NOT OK)

For realize that I have this code yaml:

resources:
  - name: mygitproject
    type: git
    source:
      uri: git@myurl.git
      branch: test

jobs:
  - name: intall
    plan:
      - get: mygitproject
        trigger: true
      - task: "npm install"
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: node
              tag: "8.15-slim"
          inputs:
            - name: mygitproject
          outputs:
            - name: node_modules
          run:
            dir: mygitproject
            path: npm
            args: ["install"]
      - task: tests
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: node
              tag: "8.15-slim"
          inputs:
            - name: mygitproject
            - name: node_modules
          run:
            dir: mygitproject
            path: sh
            args:
              - -exc
              - |
                ls .
                ls node_modules

I supposed that this operations were the same of the tutorial… ma the node_modules is always empty at the second task and always full at the first task!

Where is the error ?


#2

inputs and outputs are just sibling directories. They are not included in each other.

node_module output is just a directory sibling mygitproject directory. You must copy generated mygitproject/node_modules inside it from task “npm install” and then recopy it in task “tests”.


#3

Thank you for your support! This information help me a lot. I have then copy all the content from mygitproject/node_modules to node_modules and all it’s fine. What is missing from my opinion is a place on documentations where explicit tell that a result from a get, inputs and outputs are all at the same level when the run step is executed