gitlab 8.2.1, How to use cache in .gitlab-ci.yml

前端 未结 4 1410
感情败类
感情败类 2020-12-14 16:25

I\'m trying to use \'cache\' in .gitlab-ci.yml (http://doc.gitlab.com/ce/ci/yaml/README.html#cache). My gitlab version is 8.2.1 and my Runner is:

$ docker e         


        
4条回答
  •  独厮守ぢ
    2020-12-14 16:44

    We found out, that is better to cache the whole .gradle-folder. This should be used only once per project. If k8s used for gitlab-runner, then you should turn the daemon off.

    gitlab-ci.yaml:

    variables:
      GRADLE_OPTS: "-Dorg.gradle.daemon=false" # no gradle-daemon on k8s
    
    # ...
    
    buildJar:
      stage: build
      image: gradle:5.6.4-jdk11
      before_script:
        - export GRADLE_USER_HOME=`pwd`/.gradle
      script:
        - gradle assemble
      cache:
        key: "gradleCache"
        paths:
          - .gradle
    

提交回复
热议问题