diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 51e79218..2b730517 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,7 +1,7 @@ --- name: "Default compilation, tests and deploy" -on: +"on": push: branches: [main] paths-ignore: @@ -16,32 +16,34 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.22.2' + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.2' - - name: Build - run: make build + - name: Build + run: make build - - name: Test - run: make test + - name: Test + run: make test - - name: Minikube Installation - id: minikube - uses: medyagh/setup-minikube@latest + - name: Minikube Installation + id: minikube + uses: medyagh/setup-minikube@master + with: + cache: false - - name: Status - run: minikube status + - name: Status + run: minikube status - - name: Cluster Test - run: CLUSTER_TANG_OPERATOR_TEST=1 make test + - name: Cluster Test + run: CLUSTER_TANG_OPERATOR_TEST=1 make test - - name: Deploy and Scorecard - run: | - sh .github/workflows/scripts/retrieve_and_run_operator_sdk.sh \ - "v1.33.0" "5m" "quay.io/sec-eng-special/tang-operator-bundle" \ - "${GITHUB_HEAD_REF}" + - name: Deploy and Scorecard + run: | + sh .github/workflows/scripts/retrieve_and_run_operator_sdk.sh \ + "v1.33.0" "5m" "quay.io/sec-eng-special/tang-operator-bundle" \ + "${GITHUB_HEAD_REF}" diff --git a/.github/workflows/scripts/retrieve_and_run_operator_sdk.sh b/.github/workflows/scripts/retrieve_and_run_operator_sdk.sh index 73f4048f..d1f5f6d2 100755 --- a/.github/workflows/scripts/retrieve_and_run_operator_sdk.sh +++ b/.github/workflows/scripts/retrieve_and_run_operator_sdk.sh @@ -101,6 +101,6 @@ mv "operator-sdk_${OS}_${ARCH}" "$(pwd)/operator-sdk" chmod +x "$(pwd)/operator-sdk" "$(pwd)"/operator-sdk olm install --timeout "${TIMEOUT}" "$(pwd)"/operator-sdk olm status -"$(pwd)"/operator-sdk run bundle --verbose --timeout "${TIMEOUT}" "${BUNDLE_IMG_VERSION}" +"$(pwd)"/operator-sdk run bundle --timeout "${TIMEOUT}" "${BUNDLE_IMG_VERSION}" "$(pwd)"/operator-sdk olm status "$(pwd)"/operator-sdk scorecard --wait-time="${TIMEOUT}" "${BUNDLE_IMG_VERSION}" diff --git a/tools/cluster_tools/add_cluster.sh b/tools/cluster_tools/add_cluster.sh index 28007300..8d57507b 100755 --- a/tools/cluster_tools/add_cluster.sh +++ b/tools/cluster_tools/add_cluster.sh @@ -21,8 +21,22 @@ NAMESPACE="" alias cp='cp -rfv' function usage() { - echo "$1 -f config-file [-c context] [-n namespace]" - return "$2" + local sourced=1 + echo "" + { + [[ -n $ZSH_VERSION && $ZSH_EVAL_CONTEXT =~ :file$ ]] || + [[ -n $BASH_VERSION ]] && [[ $0 != "${BASH_SOURCE[0]}" ]] + } && sourced=1 || sourced=0 + if [ "${sourced}" -eq 0 ]; + then + echo "$1 -f config-file [-c context] [-n namespace]" + echo "" + exit "$2" + else + echo "${BASH_ARGV[0]} -f config-file [-c context] [-n namespace]" + echo "" + return "$2" + fi } while getopts "f:c:n:h" arg @@ -37,16 +51,16 @@ do n) NAMESPACE=${OPTARG} echo "NAMESPACE=${NAMESPACE}" ;; - h) usage "$0" 0 + h) usage "$0" 0 || return 0 ;; - *) usage "$0" 1 + *) usage "$0" 1 || return 1 ;; esac done if [ -z "${CONFIG_FILE}" ]; then - usage "$0" 1 + usage "$0" 1 || return 1 fi CONFIG_FILE_PATH=$(readlink -f "${CONFIG_FILE}")