Help us learn about your current experience with the documentation. Take the survey.

Windows 上的托管运行器

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com
  • Status: Beta

Windows 上的托管运行器通过在 Google Cloud Platform 上启动虚拟机来自动扩展。该解决方案使用了 GitLab 为 custom executor 开发的 autoscaling driver。Windows 上的托管运行器处于 beta 阶段。

我们希望持续迭代,使 Windows 运行器达到稳定状态并实现 generally available。你可以通过 related epic 跟踪我们为实现这一目标所做的工作。

Windows 可用的机器类型

GitLab 为 Windows 上的托管运行器提供以下机器类型。

Runner 标签 vCPUs 内存 存储
saas-windows-medium-amd64 2 7.5 GB 75 GB

支持的 Windows 版本

Windows 运行器虚拟机实例不使用 GitLab Docker executor。这意味着你无法在流水线配置中指定 imageservices

你可以在以下 Windows 版本中执行你的任务:

版本 状态
Windows 2022 GA

你可以在 pre-installed software documentation 中找到可用预装软件的完整列表。

支持的 shell

Windows 上的托管运行器已配置 PowerShell 作为 shell。因此,你的 .gitlab-ci.yml 文件中的 script 部分需要使用 PowerShell 命令。

示例 .gitlab-ci.yml 文件

使用以下示例 .gitlab-ci.yml 文件开始使用 Windows 上的托管运行器:

.windows_job:
  tags:
    - saas-windows-medium-amd64
  before_script:
    - Set-Variable -Name "time" -Value (date -Format "%H:%m")
    - echo ${time}
    - echo "started by ${GITLAB_USER_NAME} / @${GITLAB_USER_LOGIN}"

build:
  extends:
    - .windows_job
  stage: build
  script:
    - echo "running scripts in the build job"

test:
  extends:
    - .windows_job
  stage: test
  script:
    - echo "running scripts in the test job"

已知问题

  • 有关 beta 功能支持的更多信息,请参阅 beta
  • 新 Windows 虚拟机(VM)的平均准备时间为五分钟,因此在 beta 阶段,你可能会注意到 Windows 运行器集群的构建启动时间较慢。计划在未来的版本中更新 autoscaler 以启用虚拟机的预准备。此更新旨在显著减少在 Windows 集群上准备 VM 所需的时间。更多信息请参阅 issue 32
  • Windows 运行器集群可能偶尔因维护或更新而不可用。
  • 作业可能比 Linux 运行器保持等待状态的时间更长。
  • 我们可能会引入破坏性更改,这将需要更新使用 Windows 运行器集群的流水线。