🔧 chore(runner): allow preset identity overrides via env
This commit is contained in:
parent
e5db752c55
commit
40fa747a94
|
|
@ -1,2 +1,4 @@
|
|||
GITEA_INSTANCE=https://git.mytsl.cn
|
||||
GITEA_TOKEN=
|
||||
DEFAULT_RUNNER_NAME=buildx-archlinux
|
||||
DEFAULT_RUNNER_LABEL=archlinux:host://archlinux:latest,company-server:host://archlinux:latest,buildx-archlinux:host://archlinux:latest
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ services:
|
|||
- BINFMT_METHOD=tonistiigi
|
||||
- GITEA_INSTANCE=${GITEA_INSTANCE}
|
||||
- GITEA_TOKEN=${GITEA_TOKEN}
|
||||
- DEFAULT_RUNNER_NAME=buildx-archlinux
|
||||
- DEFAULT_RUNNER_LABEL=archlinux:host://archlinux:latest,company-server:host://archlinux:latest,buildx-archlinux:host://archlinux:latest
|
||||
- DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-buildx-archlinux}
|
||||
- DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-archlinux:host://archlinux:latest,company-server:host://archlinux:latest,buildx-archlinux:host://archlinux:latest}
|
||||
|
||||
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
|
||||
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
GITEA_INSTANCE=https://git.mytsl.cn
|
||||
GITEA_TOKEN=
|
||||
DEFAULT_RUNNER_NAME=buildx-ubuntu-22
|
||||
DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,buildx-ubuntu-22:host://ubuntu:22.04
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ services:
|
|||
- ENABLE_BUILDX=true
|
||||
- GITEA_INSTANCE=${GITEA_INSTANCE}
|
||||
- GITEA_TOKEN=${GITEA_TOKEN}
|
||||
- DEFAULT_RUNNER_NAME=buildx-ubuntu-22
|
||||
- DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,buildx-ubuntu-22:host://ubuntu:22.04
|
||||
- DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-buildx-ubuntu-22}
|
||||
- DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,buildx-ubuntu-22:host://ubuntu:22.04}
|
||||
|
||||
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
|
||||
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
GITEA_INSTANCE=https://git.mytsl.cn
|
||||
GITEA_TOKEN=
|
||||
DEFAULT_RUNNER_NAME=standard-ubuntu-22
|
||||
DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,standard-ubuntu-22:host://ubuntu:22.04
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ services:
|
|||
- ENABLE_BUILDX=false
|
||||
- GITEA_INSTANCE=${GITEA_INSTANCE}
|
||||
- GITEA_TOKEN=${GITEA_TOKEN}
|
||||
- DEFAULT_RUNNER_NAME=standard-ubuntu-22
|
||||
- DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,standard-ubuntu-22:host://ubuntu:22.04
|
||||
- DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-standard-ubuntu-22}
|
||||
- DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,standard-ubuntu-22:host://ubuntu:22.04}
|
||||
|
||||
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
|
||||
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
|
||||
|
|
|
|||
|
|
@ -124,9 +124,34 @@ test_preset_env_examples_exist() {
|
|||
test -f "${file}" || fail "missing env example: ${file}"
|
||||
grep -q '^GITEA_INSTANCE=https://git.mytsl.cn$' "${file}" || fail "${file} should include company default instance"
|
||||
grep -q '^GITEA_TOKEN=$' "${file}" || fail "${file} should include empty token placeholder"
|
||||
grep -q '^DEFAULT_RUNNER_NAME=' "${file}" || fail "${file} should define DEFAULT_RUNNER_NAME override example"
|
||||
grep -q '^DEFAULT_RUNNER_LABEL=' "${file}" || fail "${file} should define DEFAULT_RUNNER_LABEL override example"
|
||||
done
|
||||
}
|
||||
|
||||
test_preset_compose_supports_runner_identity_overrides() {
|
||||
grep -q 'DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-standard-ubuntu-22}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/standard-ubuntu-22/docker-compose.yml" || \
|
||||
fail "standard preset should allow DEFAULT_RUNNER_NAME override via env"
|
||||
grep -q 'DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,standard-ubuntu-22:host://ubuntu:22.04}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/standard-ubuntu-22/docker-compose.yml" || \
|
||||
fail "standard preset should allow DEFAULT_RUNNER_LABEL override via env"
|
||||
|
||||
grep -q 'DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-buildx-ubuntu-22}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/buildx-ubuntu-22/docker-compose.yml" || \
|
||||
fail "buildx ubuntu preset should allow DEFAULT_RUNNER_NAME override via env"
|
||||
grep -q 'DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,buildx-ubuntu-22:host://ubuntu:22.04}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/buildx-ubuntu-22/docker-compose.yml" || \
|
||||
fail "buildx ubuntu preset should allow DEFAULT_RUNNER_LABEL override via env"
|
||||
|
||||
grep -q 'DEFAULT_RUNNER_NAME=${DEFAULT_RUNNER_NAME:-buildx-archlinux}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/buildx-archlinux/docker-compose.yml" || \
|
||||
fail "buildx arch preset should allow DEFAULT_RUNNER_NAME override via env"
|
||||
grep -q 'DEFAULT_RUNNER_LABEL=${DEFAULT_RUNNER_LABEL:-archlinux:host://archlinux:latest,company-server:host://archlinux:latest,buildx-archlinux:host://archlinux:latest}' \
|
||||
"${REPO_ROOT}/docker-runner/presets/buildx-archlinux/docker-compose.yml" || \
|
||||
fail "buildx arch preset should allow DEFAULT_RUNNER_LABEL override via env"
|
||||
}
|
||||
|
||||
test_preset_compose_uses_env_for_instance
|
||||
test_workflows_do_not_hardcode_company_server
|
||||
test_stats_workflow_uses_workflow_secret_consistently
|
||||
|
|
@ -138,5 +163,6 @@ test_readme_has_project_intro_and_navigation
|
|||
test_deployment_doc_stays_runner_focused
|
||||
test_presets_define_expected_hostname
|
||||
test_preset_env_examples_exist
|
||||
test_preset_compose_supports_runner_identity_overrides
|
||||
|
||||
echo "template_defaults_test.sh: PASS"
|
||||
|
|
|
|||
Loading…
Reference in New Issue