Skip to content

Commit adb583a

Browse files
authored
Merge pull request kubernetes-sigs#5182 from nojnhuh/reuse-artifacts
fix can_reuse_artifacts when artifact is missing
2 parents e903198 + 42e70c2 commit adb583a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

scripts/ci-build-kubernetes.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ main() {
8989
export CONFORMANCE_IMAGE="${REGISTRY}/conformance:${KUBE_IMAGE_TAG}"
9090
fi
9191

92-
if [[ "$(can_reuse_artifacts)" == "false" ]]; then
92+
if ! can_reuse_artifacts; then
9393
echo "Building Kubernetes"
9494

9595
# TODO(chewong): support multi-arch and Windows build
@@ -135,26 +135,24 @@ main() {
135135
# can_reuse_artifacts returns true if there exists Kubernetes artifacts built from a PR that we can reuse
136136
can_reuse_artifacts() {
137137
for IMAGE_NAME in "${IMAGES[@]}"; do
138-
if ! docker pull "${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}"; then
139-
echo "false" && return
138+
if ! docker manifest inspect "${REGISTRY}/${IMAGE_NAME}:${KUBE_IMAGE_TAG}" >/dev/null; then
139+
return 1
140140
fi
141141
done
142142

143143
for BINARY in "${BINARIES[@]}"; do
144144
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
145-
echo "false" && return
145+
return 1
146146
fi
147147
done
148148

149149
if [[ "${TEST_WINDOWS:-}" == "true" ]]; then
150150
for BINARY in "${WINDOWS_BINARIES[@]}"; do
151151
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
152-
echo "false" && return
152+
return 1
153153
fi
154154
done
155155
fi
156-
157-
echo "true"
158156
}
159157

160158
capz::ci-build-kubernetes::cleanup() {

0 commit comments

Comments
 (0)