...

Text file src/sigs.k8s.io/gateway-api/hack/verify-all.sh

Documentation: sigs.k8s.io/gateway-api/hack

     1#!/bin/bash
     2
     3# Copyright 2014 The Kubernetes Authors.
     4#
     5# Licensed under the Apache License, Version 2.0 (the "License");
     6# you may not use this file except in compliance with the License.
     7# You may obtain a copy of the License at
     8#
     9#     http://www.apache.org/licenses/LICENSE-2.0
    10#
    11# Unless required by applicable law or agreed to in writing, software
    12# distributed under the License is distributed on an "AS IS" BASIS,
    13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14# See the License for the specific language governing permissions and
    15# limitations under the License.
    16
    17set -o errexit
    18set -o nounset
    19set -o pipefail
    20
    21SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
    22source "${SCRIPT_ROOT}/hack/kube-env.sh"
    23
    24SILENT=true
    25
    26function is-excluded {
    27  for e in $EXCLUDE; do
    28    if [[ $1 -ef ${BASH_SOURCE} ]]; then
    29      return
    30    fi
    31    if [[ $1 -ef "$SCRIPT_ROOT/hack/$e" ]]; then
    32      return
    33    fi
    34  done
    35  return 1
    36}
    37
    38while getopts ":v" opt; do
    39  case $opt in
    40    v)
    41      SILENT=false
    42      ;;
    43    \?)
    44      echo "Invalid flag: -$OPTARG" >&2
    45      exit 1
    46      ;;
    47  esac
    48done
    49
    50if $SILENT ; then
    51  echo "Running in the silent mode, run with -v if you want to see script logs."
    52fi
    53
    54EXCLUDE="verify-all.sh"
    55
    56ret=0
    57for t in `ls $SCRIPT_ROOT/hack/verify-*.sh`
    58do
    59  if is-excluded $t ; then
    60    echo "Skipping $t"
    61    continue
    62  fi
    63  if $SILENT ; then
    64    echo -e "Verifying $t"
    65    if bash "$t" &> /dev/null; then
    66      echo -e "${color_green}SUCCESS${color_norm}"
    67    else
    68      echo -e "${color_red}FAILED${color_norm}"
    69      ret=1
    70    fi
    71  else
    72    if bash "$t"; then
    73      echo -e "${color_green}SUCCESS: $t ${color_norm}"
    74    else
    75      echo -e "${color_red}Test FAILED: $t ${color_norm}"
    76      ret=1
    77    fi
    78  fi
    79done
    80
    81exit $ret
    82
    83# ex: ts=2 sw=2 et filetype=sh

View as plain text