title: Gradle caching doesn't work with GitLab-CI
body: <p>I'm trying to use the caching mechanism but it doesn't work, I have tried different attempt but none of them seems to work for me. The listed tasks take about both about 75sec on my machine and on gitlab ci about 5-6 Minutes where the runner is downloading the dependencies again and in every pipeline.</p>
  <p><strong>The question is how can I cache the downloaded deps with gitlab ci?</strong></p>
  <pre><code>image: dockerregistry.my-image:1.0.0
  variables:
    GIT_SUBMODULE_STRATEGY: normal
    GRADLE_USER_HOME: $CI_PROJECT_DIR/.gradle
  
  cache:
    paths:
      - .gradle/wrapper
      - .gradle/caches
  
  before_script:
    - echo `pwd`
    - echo `$CI_PROJECT_DIR`
    - rm -f  .gradle/caches/modules-2/modules-2.lock
    - rm -fr .gradle/caches/*/plugin-resolution/
  
  build:
    stage: build
    script:
      - ./gradlew assemble
  
  junit:
    stage: test
    script:
       - ./gradlew test
  </code></pre>
  <p>thanks</p>
  <h2>Update</h2>
  <p>Executor: Kubernetes<br />
  Gitlab Version: 11.0.x</p>
  <pre><code>Submodule path 'my-other-application': checked out 'fxxxx1'
  Checking cache for default...
  Successfully extracted cache
  
  .........
  
  Running after script...
  $ echo &quot;End CI&quot;
  End CI
  Creating cache default...
  .gradle/wrapper: found 222 matching files          
  .gradle/caches: found 8474 matching files     
  
   
  </code></pre>