Skip to content

Commit eec051b

Browse files
author
Istemi Ekin Akkus
committed
fix docker.mk to handle empty response from remote registry
1 parent 42e33e3 commit eec051b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docker.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ endef
3535
define push_image
3636
@#echo local image name $(1)
3737
@ID=$$(docker images $(1) --format '{{.ID}}'); \
38-
RID=$$(curl -s -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $(REGISTRY)/v2/$(1)/manifests/$(VERSION)|python -c 'import json; import sys; print(json.load(sys.stdin)["config"]["digest"].split(":")[1])'); \
38+
RID2=$$(curl -s -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' $(REGISTRY)/v2/$(1)/manifests/$(VERSION)); \
39+
if [[ "$${RID2}" != "" ]]; then \
40+
RID=$$(echo $${RID2}|python -c 'import json; import sys; print(json.load(sys.stdin)["config"]["digest"].split(":")[1])'); \
41+
else \
42+
RID=""; \
43+
fi; \
3944
if [[ "$${RID}" == "$${ID}"* ]]; then \
4045
echo "Already pushed local image $(1) ($${ID}) as $(REGISTRY)/$(1):$(VERSION) ($${RID})"; \
4146
else \

0 commit comments

Comments
 (0)