在工作流文件中使用 ARC 运行器
若要分配要在运行器规模集上运行的作业,可以将规模集名称指定为 GitHub Actions 工作流文件中 runs-on 键的值。
例如,运行器规模集的以下配置将 INSTALLATION_NAME 值设置为 arc-runner-set。
# Using a Personal Access Token (PAT)
INSTALLATION_NAME="arc-runner-set"
NAMESPACE="arc-runners"
GITHUB_CONFIG_URL="https://github.com/<your_enterprise/org/repo>"
GITHUB_PAT="<PAT>"
helm install "${INSTALLATION_NAME}" \
--namespace "${NAMESPACE}" \
--create-namespace \
--set githubConfigUrl="${GITHUB_CONFIG_URL}" \
--set githubConfigSecret.github_token="${GITHUB_PAT}" \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
若要在工作流中使用此配置,请将工作流中 runs-on 键的值设置为 arc-runner-set,如以下示例所示。
jobs:
job_name:
runs-on: arc-runner-set
使用运行器规模集名称
运行器规模集名称在其所属的运行器组中是唯一的。 若要部署多个同名的运行器规模集,它们必须属于不同的运行器组。 若要详细了解如何指定运行器规模集名称,请参阅“使用 Actions Runner Controller 部署运行程序规模集”。
您可以使用运行器规模集的安装名称,或者在您的values.yaml文件中定义runnerScaleSetName字段的值,作为您的runs-on目标。 还可以为规模集分配多个标签,以实现更灵活的作业路由。 若要为运行器规模集配置标签,请在 values.yaml 文件中设置 runnerScaleSetLabels 值。 有关详细信息,请参阅“使用 Actions Runner Controller 部署运行程序规模集”。
使用标签针对性地管理运行器规模集
还可以将多个标签分配给运行器规模集,并使用这些标签在工作流中有针对性地管理运行器。 若要为运行器规模集配置标签,请在 values.yaml 文件中设置 runnerScaleSetLabels 值。
runnerScaleSetLabels:
- linux
- gpu
- private-network
若要将具有特定标签的 Runner 规模集作为目标,请在工作流的 runs-on 键中将这些标签指定为一个数组。
jobs:
job_name:
runs-on: [linux, gpu, private-network]
法律通告
部分内容改编自 Apache-2.0 许可证下的 https://github.com/actions/actions-runner-controller/ :
Copyright 2019 Moto Ishizawa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.