From ad8162f07ef1637ab5a32bc428bc8573089cc747 Mon Sep 17 00:00:00 2001 From: nanxun Date: Wed, 12 Aug 2026 15:37:36 +0800 Subject: [PATCH] fix(ci): build native amd64 image without buildx --- Jenkinsfile | 16 +--------------- scripts/ci-docker.sh | 2 +- tests/test_fnos_dependency_script.py | 7 +++++++ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0e97771..d6c65e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,6 @@ pipeline { OPENLIST_REMOTE_DIR = '/yidongpan/构建产物/imagefind' HTTP_PROXY_URL = 'http://192.168.5.200:7890' NO_PROXY_HOSTS = '127.0.0.1,localhost,reg.nxsir.cn,gitea.nxsir.cn,openlist.nxsir.cn,pypi.tuna.tsinghua.edu.cn' - BUILDER_NAME = "imagefind-${BUILD_NUMBER}" DOCKER_CONFIG = "${WORKSPACE}/.ci/docker" NPM_CONFIG_CACHE = "${WORKSPACE}/.ci/npm-cache" PIP_CACHE_DIR = "${WORKSPACE}/.ci/pip-cache" @@ -130,18 +129,7 @@ pipeline { withCredentials([usernamePassword(credentialsId: "${NODE_CREDENTIALS}", usernameVariable: 'JENKINS_NODE_USERNAME', passwordVariable: 'JENKINS_NODE_PASSWORD')]) { sh ''' set -euo pipefail - ./scripts/ci-docker.sh buildx rm -f "$BUILDER_NAME" >/dev/null 2>&1 || true - ./scripts/ci-docker.sh buildx create --name "$BUILDER_NAME" --driver docker-container \ - --driver-opt network=host \ - --driver-opt "env.http_proxy=$HTTP_PROXY_URL" \ - --driver-opt "env.https_proxy=$HTTP_PROXY_URL" \ - --driver-opt "env.HTTP_PROXY=$HTTP_PROXY_URL" \ - --driver-opt "env.HTTPS_PROXY=$HTTP_PROXY_URL" \ - --driver-opt "env.no_proxy=reg.nxsir.cn" \ - --driver-opt "env.NO_PROXY=reg.nxsir.cn" --use - ./scripts/ci-docker.sh buildx inspect "$BUILDER_NAME" --bootstrap - ./scripts/ci-docker.sh buildx build --builder "$BUILDER_NAME" --platform linux/amd64 --network host \ - --progress=plain --provenance=false --no-cache --load \ + DOCKER_BUILDKIT=0 ./scripts/ci-docker.sh build --network host --no-cache \ --build-arg HTTP_PROXY="$HTTP_PROXY_URL" --build-arg HTTPS_PROXY="$HTTP_PROXY_URL" \ --build-arg NO_PROXY="$NO_PROXY_HOSTS" -t "$IMAGE_REF" . smoke_name="imagefind-smoke-$BUILD_NUMBER" @@ -175,7 +163,6 @@ pipeline { test -s .ci/docker-data/postgres-client.conf test -e .ci/docker-data/.imagefind-admin-initialized ./scripts/ci-docker.sh rm -f "$smoke_name" - ./scripts/ci-docker.sh buildx prune --builder "$BUILDER_NAME" --all --force ''' } } @@ -252,7 +239,6 @@ PY sh ''' set +e ./scripts/ci-docker.sh rm -f "imagefind-smoke-$BUILD_NUMBER" >/dev/null 2>&1 || true - ./scripts/ci-docker.sh buildx rm -f "$BUILDER_NAME" >/dev/null 2>&1 || true for tag in "$IMMUTABLE_TAG" "$APP_VERSION" latest; do ./scripts/ci-docker.sh rmi "$IMAGE_REPO:$tag" >/dev/null 2>&1 || true; done : >"$DOCKER_CONFIG/config.json" 2>/dev/null || true ''' diff --git a/scripts/ci-docker.sh b/scripts/ci-docker.sh index 74bcbea..f4c0ab7 100755 --- a/scripts/ci-docker.sh +++ b/scripts/ci-docker.sh @@ -6,5 +6,5 @@ set -euo pipefail printf '%s\n' "$JENKINS_NODE_PASSWORD" | sudo -S -p '' -v sudo -n -- \ - /usr/bin/env "DOCKER_CONFIG=${DOCKER_CONFIG:-}" \ + /usr/bin/env "DOCKER_CONFIG=${DOCKER_CONFIG:-}" "DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-}" \ /usr/bin/docker "$@" diff --git a/tests/test_fnos_dependency_script.py b/tests/test_fnos_dependency_script.py index 2723186..a583c0b 100644 --- a/tests/test_fnos_dependency_script.py +++ b/tests/test_fnos_dependency_script.py @@ -12,3 +12,10 @@ def test_jenkins_uses_fast_index_for_every_pip_stage() -> None: pipeline = (Path(__file__).parents[1] / "Jenkinsfile").read_text() assert "PIP_INDEX_URL = 'https://pypi.tuna.tsinghua.edu.cn/simple'" in pipeline assert "PIP_DEFAULT_TIMEOUT = '60'" in pipeline + + +def test_native_amd64_pipeline_does_not_boot_buildx() -> None: + pipeline = (Path(__file__).parents[1] / "Jenkinsfile").read_text() + assert 'test "$(uname -m)" = x86_64' in pipeline + assert "DOCKER_BUILDKIT=0 ./scripts/ci-docker.sh build" in pipeline + assert "buildx" not in pipeline