From 76a7df9ed90b499880cf497af7112a5400b5a2af Mon Sep 17 00:00:00 2001 From: hbelmiro Date: Mon, 2 Sep 2024 15:52:22 -0300 Subject: [PATCH] Improvements to wait_for_pods function Signed-off-by: hbelmiro --- .../workflows/kfp-kubernetes-execution-tests.yml | 1 + .github/workflows/kfp-samples.yml | 1 + .../kubeflow-pipelines-integration-v2.yml | 1 + .github/workflows/sdk-execution.yml | 1 + .github/workflows/upgrade-test.yml | 1 + scripts/deploy/github/helper-functions.sh | 16 +++++----------- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/kfp-kubernetes-execution-tests.yml b/.github/workflows/kfp-kubernetes-execution-tests.yml index f382c1d8324e..8895ed9b67f9 100644 --- a/.github/workflows/kfp-kubernetes-execution-tests.yml +++ b/.github/workflows/kfp-kubernetes-execution-tests.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - '.github/workflows/kfp-kubernetes-execution-tests.yml' + - 'scripts/deploy/github/**' - 'sdk/python/**' - 'api/v2alpha1/**' - 'kubernetes_platform/**' diff --git a/.github/workflows/kfp-samples.yml b/.github/workflows/kfp-samples.yml index 08cbed5d14a8..7b7707f5fc04 100644 --- a/.github/workflows/kfp-samples.yml +++ b/.github/workflows/kfp-samples.yml @@ -6,6 +6,7 @@ on: - master pull_request: paths: + - 'scripts/deploy/github/**' - 'samples/**' - 'backend/src/v2/**' - '.github/workflows/kfp-samples.yml' diff --git a/.github/workflows/kubeflow-pipelines-integration-v2.yml b/.github/workflows/kubeflow-pipelines-integration-v2.yml index 5de0b55b937f..0afa4161701e 100644 --- a/.github/workflows/kubeflow-pipelines-integration-v2.yml +++ b/.github/workflows/kubeflow-pipelines-integration-v2.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - '.github/workflows/kubeflow-pipelines-integration-v2.yml' + - 'scripts/deploy/github/**' - 'samples' - 'core' - 'backend' diff --git a/.github/workflows/sdk-execution.yml b/.github/workflows/sdk-execution.yml index 22f605fca9f6..135296844c81 100644 --- a/.github/workflows/sdk-execution.yml +++ b/.github/workflows/sdk-execution.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - '.github/workflows/sdk-execution.yml' + - 'scripts/deploy/github/**' - 'sdk/python/**' - 'api/v2alpha1/**' diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml index 83b13c9af5c2..4a2da52a2f8d 100644 --- a/.github/workflows/upgrade-test.yml +++ b/.github/workflows/upgrade-test.yml @@ -7,6 +7,7 @@ on: pull_request: paths: - '.github/workflows/upgrade-test.yml' + - 'scripts/deploy/github/**' - 'backend/**' - 'manifests/kustomize/**' diff --git a/scripts/deploy/github/helper-functions.sh b/scripts/deploy/github/helper-functions.sh index 8c42a923f460..7017d5c8b1d6 100644 --- a/scripts/deploy/github/helper-functions.sh +++ b/scripts/deploy/github/helper-functions.sh @@ -74,20 +74,14 @@ wait_for_pods () { local statuses local num_pods local num_running - pods=$(kubectl get pod -n "$namespace") - # echo "$pods" - # kubectl get pvc -n "$namespace" + pods=$(kubectl get pod -n "$namespace" --no-headers 2>/dev/null) - if [[ -z $pods ]] - then - echo "no pod is up yet" + if [[ -z $pods ]]; then + echo "No pods found or error retrieving pods." else - # Using quotations around variables to keep column format in echo - # Remove 1st line (header line) -> trim whitespace -> cut statuses column (3rd column) - # Might be overkill to parse down to specific columns :). - statuses=$(echo "$pods" | tail -n +2 | tr -s ' ' | cut -d ' ' -f 3) + statuses=$(echo "$pods" | awk '{print $3}') num_pods=$(echo "$statuses" | wc -l | xargs) - num_running=$(echo "$statuses" | grep -ow "Running\|Completed" | wc -l | xargs) + num_running=$(echo "$statuses" | grep -cE 'Running|Completed') local msg="${num_running}/${num_pods} pods running in \"${namespace}\"."