Skip to content

Commit

Permalink
Merge pull request #5183 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…5182-to-release-1.16

[release-1.16] fix can_reuse_artifacts when artifact is missing
  • Loading branch information
k8s-ci-robot authored Oct 15, 2024
2 parents 1017514 + 27a89ce commit 953b235
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/ci-build-kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 953b235

Please sign in to comment.