fix: add --network=host to docker and fix build tool fallback order
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build-almalinux8 Pipeline was successful
ci/woodpecker/pr/build-almalinux9 Pipeline was successful

Pass --network=host to docker build and docker create so package builds
can reach the network. Reorder auto-detection so Docker is tried before
buildah/native, only falling back when the explicit flag is not set.
This commit is contained in:
2026-04-25 16:11:40 +10:00
parent 111ea50d80
commit 818a48fa78
+8 -2
View File
@@ -769,6 +769,7 @@ def build_package_docker(
build_args = [ build_args = [
'docker', 'build', 'docker', 'build',
'--pull', '--pull',
'--network=host',
'-f', str(central_dockerfile), '-f', str(central_dockerfile),
'--build-arg', f'BASE_IMAGE={base_image}', '--build-arg', f'BASE_IMAGE={base_image}',
'--build-arg', f'PACKAGE_NAME={package_name}', '--build-arg', f'PACKAGE_NAME={package_name}',
@@ -801,6 +802,7 @@ def build_package_docker(
# Step 2: Create and start container # Step 2: Create and start container
create_args = [ create_args = [
'docker', 'create', 'docker', 'create',
'--network=host',
'--name', container_name, '--name', container_name,
image_name image_name
] ]
@@ -1455,9 +1457,13 @@ class Builder:
return True return True
# Check build tool availability (unless dry run) # Check build tool availability (unless dry run)
use_native = native or (not buildah and check_native_build_deps()) use_native = native
use_buildah = buildah or (not use_native and check_buildah_available()) use_buildah = buildah
use_docker = not use_native and not use_buildah and check_docker_available() use_docker = not use_native and not use_buildah and check_docker_available()
if not use_native and not use_buildah and not use_docker:
use_buildah = check_buildah_available()
if not use_native and not use_buildah and not use_docker:
use_native = check_native_build_deps()
if not dry_run and not use_native and not use_buildah and not use_docker: if not dry_run and not use_native and not use_buildah and not use_docker:
self.logger.error("No build tools available (tried native, Buildah, Docker)") self.logger.error("No build tools available (tried native, Buildah, Docker)")