Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Avoid terminal close due to sourced add_cluster.sh (#295)
Browse files Browse the repository at this point in the history
Resolves: #294

Signed-off-by: Sergio Arroutbi <[email protected]>
  • Loading branch information
sarroutbi authored May 8, 2024
1 parent afbbe8f commit 3859990
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
48 changes: 25 additions & 23 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "Default compilation, tests and deploy"

on:
"on":
push:
branches: [main]
paths-ignore:
Expand All @@ -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}"
2 changes: 1 addition & 1 deletion .github/workflows/scripts/retrieve_and_run_operator_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
24 changes: 19 additions & 5 deletions tools/cluster_tools/add_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}")
Expand Down

0 comments on commit 3859990

Please sign in to comment.