import-stx: better check for k8s namespace

"kubectl get namespace" occasionally fails, and the build thinks the
namespace doesn't exist. Improve this call:
* try to get the namespace by name, instead of listing all namespaces and
  grep'ing the output
* don't suppress STDERR

Story: 2010055
Task: 50765

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: I3923d4765f9cf578f5f525a1aeac3c640a4f7b7e
This commit is contained in:
Davlet Panech 2024-08-07 09:44:55 -04:00
parent 26703529f7
commit 2ec13b59c9

View File

@ -242,7 +242,7 @@ elif [ "$STX_PLATFORM" = "kubernetes" ]; then
return 1
fi
if ! kubectl get namespace 2>/dev/null | grep -q $STX_K8S_NAMESPACE; then
if ! kubectl get namespace "$STX_K8S_NAMESPACE" >/dev/null ; then
notice_warn "namespace $STX_K8S_NAMESPACE not found"
return 1
fi