Skip to content

Commit 7d26def

Browse files
committed
config: add gitproxy GitHub mirror driven by GITPROXY_ADDRESS
Forward GITPROXY_ADDRESS into the build container and auto-select GITHUB_MIRROR=gitproxy when a CI runner advertises a pass-through git proxy (exported from NetBox). The gitproxy case points GITHUB_SOURCE at the proxy so git clones route through it without manual flags. Signed-off-by: Igor Pecovnik <igor@armbian.com>
1 parent adead19 commit 7d26def

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lib/functions/configuration/main-config.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ function do_main_configuration() {
234234

235235
[[ $USE_GITHUB_UBOOT_MIRROR == yes ]] && UBOOT_MIRROR=github # legacy compatibility?
236236

237+
# A CI runner that advertises a pass-through git proxy (GITPROXY_ADDRESS,
238+
# exported from NetBox by the runner) selects the gitproxy mirror
239+
# automatically, unless an explicit GITHUB_MIRROR was already set.
240+
[[ -z $GITHUB_MIRROR && -n ${GITPROXY_ADDRESS:-} ]] && GITHUB_MIRROR=gitproxy
241+
237242
case $GITHUB_MIRROR in
238243
fastgit)
239244
declare -g -r GITHUB_SOURCE='https://hub.fastgit.xyz'
@@ -242,6 +247,9 @@ function do_main_configuration() {
242247
[[ -z $GHPROXY_ADDRESS ]] && GHPROXY_ADDRESS=ghfast.top
243248
declare -g -r GITHUB_SOURCE="https://${GHPROXY_ADDRESS}/https://github.com"
244249
;;
250+
gitproxy)
251+
declare -g -r GITHUB_SOURCE="${GITPROXY_ADDRESS}"
252+
;;
245253
gitclone)
246254
declare -g -r GITHUB_SOURCE='https://gitclone.com/github.com'
247255
;;

lib/functions/host/docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ function docker_cli_prepare_launch() {
451451
"--env" "no_proxy=${no_proxy:-${NO_PROXY:-}}"
452452
"--env" "NO_PROXY=${NO_PROXY:-${no_proxy:-}}"
453453
"--env" "APT_PROXY_ADDR=${APT_PROXY_ADDR:-}"
454+
"--env" "GITPROXY_ADDRESS=${GITPROXY_ADDRESS:-}"
454455
)
455456

456457
# Pass in host DNS server so container can resolve hostnames on proxy

0 commit comments

Comments
 (0)