fix(ci): build native amd64 image without buildx
This commit is contained in:
Vendored
+1
-15
@@ -26,7 +26,6 @@ pipeline {
|
|||||||
OPENLIST_REMOTE_DIR = '/yidongpan/构建产物/imagefind'
|
OPENLIST_REMOTE_DIR = '/yidongpan/构建产物/imagefind'
|
||||||
HTTP_PROXY_URL = 'http://192.168.5.200:7890'
|
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'
|
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"
|
DOCKER_CONFIG = "${WORKSPACE}/.ci/docker"
|
||||||
NPM_CONFIG_CACHE = "${WORKSPACE}/.ci/npm-cache"
|
NPM_CONFIG_CACHE = "${WORKSPACE}/.ci/npm-cache"
|
||||||
PIP_CACHE_DIR = "${WORKSPACE}/.ci/pip-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')]) {
|
withCredentials([usernamePassword(credentialsId: "${NODE_CREDENTIALS}", usernameVariable: 'JENKINS_NODE_USERNAME', passwordVariable: 'JENKINS_NODE_PASSWORD')]) {
|
||||||
sh '''
|
sh '''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
./scripts/ci-docker.sh buildx rm -f "$BUILDER_NAME" >/dev/null 2>&1 || true
|
DOCKER_BUILDKIT=0 ./scripts/ci-docker.sh build --network host --no-cache \
|
||||||
./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 \
|
|
||||||
--build-arg HTTP_PROXY="$HTTP_PROXY_URL" --build-arg HTTPS_PROXY="$HTTP_PROXY_URL" \
|
--build-arg HTTP_PROXY="$HTTP_PROXY_URL" --build-arg HTTPS_PROXY="$HTTP_PROXY_URL" \
|
||||||
--build-arg NO_PROXY="$NO_PROXY_HOSTS" -t "$IMAGE_REF" .
|
--build-arg NO_PROXY="$NO_PROXY_HOSTS" -t "$IMAGE_REF" .
|
||||||
smoke_name="imagefind-smoke-$BUILD_NUMBER"
|
smoke_name="imagefind-smoke-$BUILD_NUMBER"
|
||||||
@@ -175,7 +163,6 @@ pipeline {
|
|||||||
test -s .ci/docker-data/postgres-client.conf
|
test -s .ci/docker-data/postgres-client.conf
|
||||||
test -e .ci/docker-data/.imagefind-admin-initialized
|
test -e .ci/docker-data/.imagefind-admin-initialized
|
||||||
./scripts/ci-docker.sh rm -f "$smoke_name"
|
./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 '''
|
sh '''
|
||||||
set +e
|
set +e
|
||||||
./scripts/ci-docker.sh rm -f "imagefind-smoke-$BUILD_NUMBER" >/dev/null 2>&1 || true
|
./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
|
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
|
: >"$DOCKER_CONFIG/config.json" 2>/dev/null || true
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ set -euo pipefail
|
|||||||
printf '%s\n' "$JENKINS_NODE_PASSWORD" | sudo -S -p '' -v
|
printf '%s\n' "$JENKINS_NODE_PASSWORD" | sudo -S -p '' -v
|
||||||
|
|
||||||
sudo -n -- \
|
sudo -n -- \
|
||||||
/usr/bin/env "DOCKER_CONFIG=${DOCKER_CONFIG:-}" \
|
/usr/bin/env "DOCKER_CONFIG=${DOCKER_CONFIG:-}" "DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-}" \
|
||||||
/usr/bin/docker "$@"
|
/usr/bin/docker "$@"
|
||||||
|
|||||||
@@ -12,3 +12,10 @@ def test_jenkins_uses_fast_index_for_every_pip_stage() -> None:
|
|||||||
pipeline = (Path(__file__).parents[1] / "Jenkinsfile").read_text()
|
pipeline = (Path(__file__).parents[1] / "Jenkinsfile").read_text()
|
||||||
assert "PIP_INDEX_URL = 'https://pypi.tuna.tsinghua.edu.cn/simple'" in pipeline
|
assert "PIP_INDEX_URL = 'https://pypi.tuna.tsinghua.edu.cn/simple'" in pipeline
|
||||||
assert "PIP_DEFAULT_TIMEOUT = '60'" 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
|
||||||
|
|||||||
Reference in New Issue
Block a user