From 27a89ce7d26de1e5ec7f4ab6806f9a94e6ae8d58 Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Mon, 14 Oct 2024 19:04:47 -0500 Subject: [PATCH] fix can_reuse_artifacts when artifact is missing --- scripts/ci-build-kubernetes.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/ci-build-kubernetes.sh b/scripts/ci-build-kubernetes.sh index 478780accc1..c7d71c4339b 100755 --- a/scripts/ci-build-kubernetes.sh +++ b/scripts/ci-build-kubernetes.sh @@ -89,7 +89,7 @@ main() { export CONFORMANCE_IMAGE="${REGISTRY}/conformance:${KUBE_IMAGE_TAG}" fi - if [[ "$(can_reuse_artifacts)" == "false" ]]; then + if ! can_reuse_artifacts; then echo "Building Kubernetes" # TODO(chewong): support multi-arch and Windows build @@ -135,26 +135,24 @@ main() { # can_reuse_artifacts returns true if there exists Kubernetes artifacts built from a PR that we can reuse can_reuse_artifacts() { for IMAGE_NAME in "${IMAGES[@]}"; do - if ! docker pull "${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}"; then - echo "false" && return + if ! docker manifest inspect "${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}" >/dev/null; then + return 1 fi done for BINARY in "${BINARIES[@]}"; do if [[ "$(az storage blob exists --auth-mode login --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" --query exists --output tsv)" == "false" ]]; then - echo "false" && return + return 1 fi done if [[ "${TEST_WINDOWS:-}" == "true" ]]; then for BINARY in "${WINDOWS_BINARIES[@]}"; do if [[ "$(az storage blob exists --auth-mode login --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists --output tsv)" == "false" ]]; then - echo "false" && return + return 1 fi done fi - - echo "true" } capz::ci-build-kubernetes::cleanup() {