title: Concourse CI - Build Artifacts inside source, pass all to next task
body: <p>I want to set up a build pipeline in Concourse for my web application. The application is built using Node.</p>
  
  <p>The plan is to do something like this:</p>
  
  <pre><code>                                        ,-&gt; build style guide -&gt; dockerize
  source code -&gt; npm install -&gt; npm test -|
                                          `-&gt; build website -&gt; dockerize
  </code></pre>
  
  <p>The problem is, after npm install, a new container is created so the <code>node_modules</code> directory is lost. I want to pass <code>node_modules</code> into the later tasks but because it is "inside" the source code, it doesn't like it and gives me</p>
  
  <pre><code>invalid task configuration:
    you may not have more than one input or output when one of them has a path of '.'
  </code></pre>
  
  <p>Here's my jobs set up</p>
  
  <pre><code>jobs:
    - name: test
      serial: true
      disable_manual_trigger: false
      plan:
        - get: source-code
          trigger: true
  
        - task: npm-install
          config:
            platform: linux
            image_resource:
              type: docker-image
              source: {repository: node, tag: "6" }
            inputs:
              - name: source-code
                path: .
            outputs:
              - name: node_modules
            run:
              path: npm
              args: [ install ]
  
        - task: npm-test
          config:
            platform: linux
            image_resource:
              type: docker-image
              source: {repository: node, tag: "6" }
            inputs:
              - name: source-code
                path: .
              - name: node_modules
            run:
              path: npm
              args: [ test ]
  </code></pre>
  
  <p><strong>Update 2016-06-14</strong></p>
  
  <p>Inputs and outputs are just directories. So you put what you want output into an output directory and you can then pass it to another task in the same job. Inputs and Outputs can not overlap, so in order to do it with npm, you'd have to either copy node_modules, or the entire source folder from the input folder to an output folder, then use that in the next task.</p>
  
  <p>This doesn't work between jobs though. Best suggestion I've seen so far is to use a temporary git repository or bucket to push <em>everything</em> up. There has to be a better way of doing this since part of what I'm trying to do is avoid huge amounts of network IO.</p>