title: Cache files are gone in my GitLab CI pipeline
body: <p>I'm trying to setup GitLab CI for a mono repository.</p>
  
  <p>For the sake of the argument, lets say I want to process 2 JavaScript packages:</p>
  
  <ul>
  <li>app</li>
  <li>cli</li>
  </ul>
  
  <p>I have defined 3 stages:</p>
  
  <ul>
  <li>install</li>
  <li>test</li>
  <li>build</li>
  <li>deploy</li>
  </ul>
  
  <p>Because I'm reusing the files from previous steps, I use the GitLab cache.</p>
  
  <p>My configuration looks like this:</p>
  
  <pre><code>stages:
    - install
    - test
    - build
    - deploy
  
  install_app:
    stage: install
    image: node:8.9
    cache:
      policy: push
      paths:
        - app/node_modules
    script:
      - cd app
      - npm install
  
  install_cli:
    stage: install
    image: node:8.9
    cache:
      policy: push
      paths:
        - cli/node_modules
    script:
      - cd cli
      - npm install
  
  test_app:
    image: node:8.9
    cache:
      policy: pull
      paths:
        - app/node_modules
    script:
      - cd app
      - npm test
  
  test_cli:
    image: node:8.9
    cache:
      policy: pull
      paths:
        - cli/node_modules
    script:
      - cd cli
      - npm test
  
  build_app:
    stage: build
    image: node:8.9
    cache:
      paths:
        - app/node_modules
        - app/build
    script:
      - cd app
      - npm run build
  
  deploy_app:
    stage: deploy
    image: registry.gitlab.com/my/gcloud/image
    only:
      - master
    environment:
      name: staging
      url: https://example.com
    cache:
      policy: pull
      paths:
        - app/build
    script:
      - gcloud app deploy app/build/app.yaml
          --verbosity info
          --version master
          --promote
          --stop-previous-version
          --quiet
          --project "$GOOGLE_CLOUD_PROJECT"
  </code></pre>
  
  <p>The problem is in the test stage. Most of the time the <code>test_app</code> job fails, because the <code>app/node_modules</code> directory is missing. Sometimes a retry works, but mostly not.</p>
  
  <p>Also, I would like to use two caches for the <code>build_app</code> job. I want to pull <code>app/node_modules</code> and push <code>app/build</code>. I can't find a way to accomplish this. This makes me feel like I don't fully understand how the cache works.</p>
  
  <p>Why are my cache files gone? Do I misunderstand how GitLab CI cache works?</p>