Skip to content

Commit dae0fce

Browse files
committed
refactor can_reuse_artifacts for cloud-provider artifacts
1 parent fd746e8 commit dae0fce

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

scripts/ci-build-azure-ccm.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ setup() {
5757
}
5858

5959
main() {
60-
if [[ "$(can_reuse_artifacts)" =~ "false" ]]; then
60+
if ! can_reuse_artifacts; then
6161
echo "Building Linux Azure amd64 cloud controller manager"
6262
make -C "${AZURE_CLOUD_PROVIDER_ROOT}" build-ccm-image-amd64 push-ccm-image-amd64
6363
echo "Building Linux amd64 and Windows (hpc) amd64 cloud node managers"
@@ -84,28 +84,26 @@ main() {
8484
can_reuse_artifacts() {
8585
declare -a IMAGES=("${CCM_IMAGE_NAME}:${IMAGE_TAG_CCM}" "${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM}")
8686
for IMAGE in "${IMAGES[@]}"; do
87-
if ! docker pull "${REGISTRY}/${IMAGE}"; then
88-
echo "false" && return
87+
if ! docker manifest inspect "${REGISTRY}/${IMAGE}" >/dev/null; then
88+
return 1
8989
fi
9090
done
9191

9292
if ! docker manifest inspect "${REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM}" | grep -q "\"os\": \"windows\""; then
93-
echo "false" && return
93+
return 1
9494
fi
9595

9696
# Do not reuse the image if there is a Windows image built with older version of this script that did not
9797
# build the images as host-process-container images. Those images cannot be pulled on mis-matched Windows Server versions.
9898
if docker manifest inspect "${REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM}" | grep -q "\"os.version\": \"10.0."; then
99-
echo "false" && return
99+
return 1
100100
fi
101101

102102
for BINARY in azure-acr-credential-provider azure-acr-credential-provider.exe credential-provider-config.yaml credential-provider-config-win.yaml; do
103103
if [[ "$(az storage blob exists --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/${BINARY}" --query exists --output tsv --auth-mode login)" == "false" ]]; then
104-
echo "false" && return
104+
return 1
105105
fi
106106
done
107-
108-
echo "true"
109107
}
110108

111109
capz::ci-build-azure-ccm::cleanup() {

0 commit comments

Comments
 (0)