百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

gitlab-tart-executor

> 编程语言
开源

GitLab 运行 Tart VM 中作业的执行程序

99 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

GitLab 运行 Tart VM 中作业的执行程序

GitLab Tart Executor

Custom GitLab Runner executor to run jobs inside ephemeral Tart macOS virtual machines.

[!IMPORTANT]

macOS 15 (Sequoia) or later

In case you've upgraded and encountering an issue below:

Waiting for the VM to boot and be SSH-able...

The newly introduced "Local Network" permission in macOS Sequoia requires accepting a GUI pop-up on each host machine that runs the GitLab Tart Executor.

To work around this, there are two options. The first one is to modify your GitLab Runner configuration to invoke the gitlab-tart-executor binary as root, with an additional --user command-line argument, which takes the name of your regular, non-privileged user on the host machine.

This will cause the GitLab Tart Executor to start a small gitlab-tart-executor localnetworkhelper process in the background and then drop the privileges to the specified user.

This helper process is privileged and is needed to establish network connections on behalf of the GitLab Tart Executor without triggering a GUI pop-up.

This approach is more secure than simply running gitlab-tart-executor as root, because only a small part of the program runs privileged, and the only functionality that this part is performing is establishing new connections.

The second workaround is to set the local network privacy preferences so that all IPv4 private address space that could potentially be used for VMs is excluded:

bash
sudo defaults write com.apple.network.local-network AllowedEthernetLocalNetworkAddresses -array "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16"
sudo defaults write com.apple.network.local-network AllowedWiFiLocalNetworkAddresses -array "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16"

...and then reboot.

Configuration

bash
brew install cirruslabs/cli/gitlab-tart-executor
toml
concurrent = 2

[[runners]]
  # ...
  executor = "custom"
  [runners.feature_flags]
    FF_RESOLVE_FULL_TLS_CHAIN = false
  [runners.custom]
    config_exec = "gitlab-tart-executor"
    config_args = ["config"]
    prepare_exec = "gitlab-tart-executor"
    prepare_args = ["prepare"]
    run_exec = "gitlab-tart-executor"
    run_args = ["run"]
    cleanup_exec = "gitlab-tart-executor"
    cleanup_args = ["cleanup"]

To use the "Local Network" helper process (see the note in the beginning of this README.md), additionally modify the prepare and run stages as follows:

toml
concurrent = 2

[[runners]]
  # ...
  executor = "custom"
  [runners.feature_flags]
    FF_RESOLVE_FULL_TLS_CHAIN = false
  [runners.custom]
    config_exec = "gitlab-tart-executor"
    config_args = ["config"]
    prepare_exec = "sudo"
    prepare_args = ["-E", "gitlab-tart-executor", "prepare", "--user", "$USER", "--concurrency", "2", "--cpu", "auto", "--memory", "auto"]
    run_exec = "sudo"
    run_args = ["-E", "gitlab-tart-executor", "run", "--user", "$USER"]
    cleanup_exec = "gitlab-tart-executor"
    cleanup_args = ["cleanup"]

And replace the $USER with the name of your regular, non-privileged user on the host machine.

Now you can use Tart Images in your .gitlab-ci.yml:

yaml
# You can use any remote Tart image.
# Tart Executor will pull it from the registry
# and use it for creating ephemeral VMs.
image: ghcr.io/cirruslabs/macos-ventura-base:latest

test:
  # In case you tagged runners that have
  # GitLab Tart Executor configured on them
  tags:
    - tart-installed

  script:
    - uname -a

Advanced configuration

Speeding up execution by mounting a temporary directory from the host

It's been noted that jobs run faster when they write to a volume mounted from the host (most likely because this avoids the copy-on-write expansion of the VM's disk).

Tart Executor will mount a temporary directory from the host automatically if you set the TART_EXECUTOR_HOST_DIR variable either in GitLab UI or in .gitlab-ci.yml:

yaml
test:
  # You can use any remote Tart image.
  # Tart Executor will pull it from the registry
  # and use it for creating ephemeral VMs.
  image: ghcr.io/cirruslabs/macos-ventura-base:latest

  # In case you tagged runners that have
  # GitLab Tart Executor configured on them
  tags:
    - tart-installed

  script:
    - uname -a

  variables:
    TART_EXECUTOR_HOST_DIR: "true"

Fully utilizing resources of the host

You can tell the Tart Executor to override the default CPU and memory settings of the VM image by passing the --cpu and --memory command-line arguments to prepare sub-command.

To avoid manually retrieving and calculating the total number CPUs and the memory on the host, pass the auto as an argument to --cpu and --memory instead of the numerical values, e.g. --cpu auto or --memory auto.

This will force the prepare stage to retrieve the total host resources internally and calculate them according to formula:

 / 

...where `` is controlled by the --concurrency command-line argument.

Here's an example on how to configure the GitLab Runner to run two Tart VMs concurrently, utilizing half of the host's resources for each VM:

toml
concurrent = 2

[[runners]]
  # ...
  executor = "custom"
  [runners.feature_flags]
    FF_RESOLVE_FULL_TLS_CHAIN = false
  [runners.custom]
    config_exec = "gitlab-tart-executor"
    config_args = ["config"]
    prepare_exec = "gitlab-tart-executor"
    prepare_args = ["prepare", "--concurrency", "2", "--cpu", "auto", "--memory", "auto"]
    run_exec = "gitlab-tart-executor"
    run_args = ["run"]
    cleanup_exec = "gitlab-tart-executor"
    cleanup_args = ["cleanup"]

Using different SSH credentials

Tart Executor uses the default admin:admin credentials when connecting to the VM over SSH.

If your image uses different credentials, set TART_EXECUTOR_SSH_USERNAME and/or TART_EXECUTOR_SSH_PASSWORD variables either in GitLab UI or in .gitlab-ci.yml:

yaml
test:
  # You can use any remote Tart image.
  # Tart Executor will pull it from the registry
  # and use it for creating ephemeral VMs.
  image: ghcr.io/cirruslabs/macos-ventura-base:latest

  # In case you tagged runners that have
  # GitLab Tart Executor configured on them
  tags:
    - tart-installed

  script:
    - uname -a

  variables:
    TART_EXECUTOR_SSH_USERNAME: "custom-username"
    TART_EXECUTOR_SSH_PASSWORD: "custom-password"

Licensing

Tart Executor is open sourced under MIT license so people can base their own executors in Go of this code. Tart itself on the other hand is source available under Fair Software License that required paid sponsorship upon exceeding a free limit.

Supported command-line arguments

config stage

Argument Default Description
--builds-dir Path to a directory on host to use for storing builds, automatically mounts that directory to the guest VM (mutually exclusive with --guest-builds-dir)
--cache-dir Path to a directory on host to use for caching purposes, automatically mounts that directory to the guest VM (mutually exclusive with --guest-cache-dir)
--guest-builds-dir1 Path to a directory in guest to use for storing builds, useful when mounting a block device (via --disk command-line argument) to the VM (mutually exclusive with --builds-dir)
--guest-cache-dir1 Path to a directory in guest to use for caching purposes, useful when mounting a block device (via --disk command-line argument to the VM (mutually exclusive with --cache-dir)

1: this is an advanced feature which should only be resorted to when the standard directory sharing via --builds-dir and --cache-dir is not sufficient for some reason.

prepare stage

Argument Default Description
--concurrency 1 Maximum number of concurrently running Tart VMs to calculate the auto resources
--cpu no override Override default image CPU configuration (number of CPUs or auto1)
--memory no override Override default image memory configuration (size in megabytes or auto1)
--dir --dir arguments to pass to tart run, can be specified multiple times
--disk --disk arguments to pass to tart run, can be specified multiple times
--auto-prune true Whether to enable or disable the Tart's auto-pruning mechanism (sets the TART_NO_AUTO_PRUNE environment variable for Tart command invocations under the hood)
--allow-image only allow running images that match the given doublestar-compatible pattern, can be specified multiple times
--default-image A fallback Tart image to use, in case the job does not specify one
--nested false Run VMs with nested virtualization enabled
--tart-run-env Environment variable overrides for tart run
--user username to drop privileges to (see the note in the beginning of this README.md about "Local Network" helper process)

run stage

Argument Default Description
--user username to drop privileges to (see the note in the beginning of this README.md about "Local Network" helper process)

1: automatically distributes all host resources according to the

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言