github.com/pachyderm/pachyderm@v1.13.4/etc/examples/pipeline-status.sh (about)

     1  #!/bin/bash
     2  # pipeline-status will return True if the pipeline specified as its argument is ready, False otherwise
     3  # takes 1 argument, the name of the pipeline
     4  # We are using the .items[*] syntax below, instead of .items[0],
     5  # because items[0] will produce an array bounds in kubectl error if the pipeline doesn't exist yet.
     6  # With .items[*], kubectl will return an empty string rather than error out.
     7  
     8  HERE="$(dirname "$0")"
     9  # shellcheck source=./etc/examples/paths.sh
    10  . "${HERE}/paths.sh"
    11  
    12  if [ $# -eq 0 ]
    13  then
    14      ${ECHO} "No arguments supplied."
    15      exit 1
    16  fi
    17  
    18  if [ -z "$1" ]
    19  then
    20      ${ECHO} "No argument supplied."
    21      exit 1
    22  fi
    23  
    24  
    25  CURRENT_STATUS=$(${KUBECTL} get pod -l suite=pachyderm,pipelineName="$1" \
    26  			-o jsonpath='{.items[*].status.conditions[?(@.type=="Ready")].status}')
    27  
    28  if [ "$CURRENT_STATUS" ]
    29  then
    30      ${ECHO} -n "$CURRENT_STATUS"
    31  else
    32      ${ECHO} -n False
    33  fi
    34