From 6d3a18b0be4f0e35307088370aacf1cd62e0fa9a Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Tue, 18 Feb 2020 19:58:35 -0800 Subject: [PATCH] test images: Image Promoter sed fix The image used by the Image Promoter (gcr.io/k8s-testimages/gcb-docker-gcloud:v20190906-745fed4) is based on busybox, and thus, the sed binary is actually busybox. image-util.sh calls kube::util::ensure-gnu-sed several times, which ensures that a GNU sed binary exists (it checks by greping GNU in its --help output). Obviously, it won't match the busybox sed binary. But the sed usage in image-util.sh is fairly simple, and the busybox sed is sufficient. This was previously fixed in: #87188, but it was reverted by #87653 as it was failing on Mac (sed does not exist). This commit fixes that issue as well. --- hack/lib/util.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 119db4ea587..43e7226597c 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -700,7 +700,8 @@ function kube::util::ensure_dockerized { function kube::util::ensure-gnu-sed { # NOTE: the echo below is a workaround to ensure sed is executed before the grep. # see: https://github.com/kubernetes/kubernetes/issues/87251 - if LANG=C sed --help 2>&1 | grep -q "GNU\|BusyBox"; then + sed_help="$(LANG=C sed --help 2>&1 || true)" + if echo "${sed_help}" | grep -q "GNU\|BusyBox"; then SED="sed" elif command -v gsed &>/dev/null; then SED="gsed"