Cache for Gradle is not working

Summary

The cache for Gradle is not working.

Steps to reproduce

  1. Create a java project with proto
  2. Add gradle protobuf plugin
  3. build.gradle file add:
protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.5.1'
    }
    plugins {
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        ofSourceSet('main').each { task ->
            task.generateDescriptorSet = true
            task.descriptorSetOptions.includeImports = true
            task.descriptorSetOptions.path =
                    "${projectDir}/build/descriptors/${project.name}.dsc"

            task.builtins {
                java {
                    outputSubDir = 'protoGen'
                }
                js {
                   outputSubDir = 'jsGen'
                }
            }
            task.plugins {
                grpc {
                    outputSubDir = 'protoGen'
                }
            }
        }
    }
    generatedFilesBaseDir = "$projectDir/src/"
}
  1. gitlab-ci.yaml file:
variables:
  DOCKER_DRIVER: overlay2
  GRADLE_OPTS: "-Dorg.gradle.daemon=false"
stages:
  - build
  - package
  - deploy
before_script:
  - export GRADLE_USER_HOME=`pwd`/.gradle
cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches
gradle-build:
  image: gradle:alpine
  stage: build
  script:
    - ./gradlew build
  only:
  - develop

Actual behavior

Build Failed

Expected behavior

Build success

Relevant logs and/or screenshots

generateProto

Download https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.5.1/protoc-3.5.1.pom

Download https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.5.1/protoc-3.5.1-linux-x86_64.exe

Download https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/1.9.0/protoc-gen-grpc-java-1.9.0.pom

Download https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/1.9.0/protoc-gen-grpc-java-1.9.0-linux-x86_64.exe

generateProto FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task 'generateProto'.

java.io.IOException: Cannot run program "$GRADLE_USER_HOME/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.5.1/e525053aa70c64b756c6c902ce4571c4767d95dc/protoc-3.5.1-linux-x86_64.exe": error=2, No such file or directory

Environment description

docker+machine aws ec2

Used GitLab Runner version

Version: 10.6.0 Git revision: a3543a27 Git branch: 10-6-stable GO version: go1.9.4 Built: 2018-03-22T08:34:11+00:00 OS/Arch: linux/amd64

Edited by Truyet