cirruslabs / gitlab-tart-executor

GitLab Runner executor to run jobs in Tart VMs
MIT License
60 stars 5 forks source link

Example for using Gitlab cache together with Tart Executor #67

Closed thomasflad closed 7 months ago

thomasflad commented 8 months ago

First of all, thank you for your work on the project!

I am currently trying to implement our CI with Gitlab and Tart. We are using Kotlin Multiplatform and building the app with Gradle. So far, so good.

However, I have problems using the Gradle build cache. I assumed that I can use --builds-dir and --cache-dir to store the Gradle cache on the host to have the cache persistent between builds.

But I get constantly errors regarding read or write permissions. For example:

Problems reading data from Binary store in /Volumes/My Shared Files/buildsdir/app/.gradle/.tmp/gradle8917629311940141513.bin offset 5524 exists?

My setup looks like this:

.gitlab-ci.yml

variables:  
  GIT_STRATEGY: clone
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_CHECKOUT: "false"

cache:
  - key:
      files:
        - gradle/wrapper/gradle-wrapper.properties
    paths:
      - .gradle/caches
      - .gradle/wrapper
      - .gradle/configuration-cache

macos_tests:
  image: ghcr.io/cirruslabs/macos-sonoma-xcode:15.2
  before_script:
    - git checkout $CI_COMMIT_REF_NAME
    - export GRADLE_USER_HOME=`pwd`/.gradle
  script:
    - cd ios
    - bundle exec fastlane tests // <- Runs also Gradle task

config.toml

[[runners]]
  name = "name"
  url = "https://url"
  id = 44
  token = "xxx"
  executor = "custom"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.custom]
    config_exec = "gitlab-tart-executor"
    config_args = ["config", "--cache-dir", "/Users/MyUser/tart-cache", "--builds-dir", "/Users/MyUser/tart-builds"]
    prepare_exec = "gitlab-tart-executor"
    prepare_args = ["prepare"]
    run_exec = "gitlab-tart-executor"
    run_args = ["run"]
    cleanup_exec = "gitlab-tart-executor"
    cleanup_args = ["cleanup"]

Does anyone have a running configuration for Gitlab + Tart in combination with Gradle Cache?

edigaryev commented 8 months ago

Looks like a symptom of https://github.com/cirruslabs/tart/issues/567 to me.

You can try a workaround, which is is to attach a block device directly to the VM, see https://github.com/cirruslabs/gitlab-tart-executor/issues/60.