Skip to content

Commit 4a52d65

Browse files
authored
Add operator installation robustness (#266)
1 parent 883c3fb commit 4a52d65

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

tests/scripts/install.sh

+42-21
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,44 @@ if ! [ -z "${SKIP_OPERATOR_INSTALL}" ]; then
1414
./setup.sh -t ~/peak/operatorsetup 2>&1
1515
else
1616
echo "Installing operator from community marketplace"
17-
while [[ $retry -gt 0 ]]; do
1817

19-
# patch bug in peak setup script
20-
sed -i "s/path=\"{.status.channels.*/ | jq '.status.channels | .[0].currentCSVDesc.installModes | map(select(.type == \"AllNamespaces\")) | .[0].supported')/" setup.sh
21-
sed -i "s/csource=.*/echo \$3; csource=\$3/" setup.sh
22-
sed -i 's/installop \$.*/installop \${vals[0]} \${vals[1]} \${vals[3]}/' setup.sh
18+
start_t=$(date +%s) 2>&1
19+
ready=false 2>&1
20+
while ! $ready; do
21+
CATALOG_SOURCES=$(oc get catalogsources -n openshift-marketplace 2> /dev/null | grep 'community-operators')
22+
if [ ! -z "${CATALOG_SOURCES}" ]; then
23+
echo $CATALOG_SOURCES
24+
ready=true 2>&1
25+
else
26+
sleep 10
27+
fi
28+
if [ $(($(date +%s)-start_t)) -gt 300 ]; then
29+
echo "Marketplace pods never started"
30+
exit 1
31+
fi
32+
done
33+
34+
start_t=$(date +%s) 2>&1
35+
ready=false 2>&1
36+
while ! $ready; do
37+
MANIFESTS=$(oc get packagemanifests -n openshift-marketplace 2> /dev/null | grep 'opendatahub')
38+
echo $MANIFESTS
39+
if [ ! -z "${MANIFESTS}" ]; then
40+
echo $MANIFESTS
41+
ready=true 2>&1
42+
else
43+
sleep 10
44+
fi
45+
if [ $(($(date +%s)-start_t)) -gt 900 ]; then
46+
echo "Package manifests never downloaded"
47+
exit 1
48+
fi
49+
done
50+
51+
while [[ $retry -gt 0 ]]; do
52+
./setup.sh -o ~/peak/operatorsetup\
2353

24-
./setup.sh -o ~/peak/operatorsetup
54+
# approve installplans
2555
if [ $? -eq 0 ]; then
2656
retry=-1
2757
else
@@ -31,11 +61,16 @@ else
3161
fi
3262
retry=$(( retry - 1))
3363

64+
sleep 30
65+
echo "Approving Install Plans, if needed"
66+
oc patch installplan $(oc get installplan -n openshift-operators | grep $ODH_VERSION | awk '{print $1}') -n openshift-operators --type merge --patch '{"spec":{"approved":true}}' || true
67+
oc patch installplan $(oc get installplan -n openshift-operators | grep authorino | awk '{print $1}') -n openshift-operators --type merge --patch '{"spec":{"approved":true}}' || true
68+
3469
finished=false 2>&1
3570
start_t=$(date +%s) 2>&1
3671
echo "Verifying installation of ODH operator"
3772
while ! $finished; do
38-
if [ ! -z "$(oc get pods -n openshift-operators | grep 'opendatahub-operator-controller-manager' | grep '1/1')" ]; then
73+
if [ ! -z "$(oc get pods -n openshift-operators | grep 'opendatahub-operator-controller-manager' | grep '1/1')" ]; then
3974
finished=true 2>&1
4075
else
4176
sleep 10
@@ -50,20 +85,6 @@ else
5085
done
5186
fi
5287

53-
#popd
54-
### Grabbing and applying the patch in the PR we are testing
55-
#pushd ~/src/${REPO_NAME}
56-
#if [ -z "$PULL_NUMBER" ]; then
57-
# echo "No pull number, assuming nightly run"
58-
#else
59-
# if [ $REPO_OWNER == "trustyai-explainability" ]; then
60-
# curl -O -L https://github.com/${REPO_OWNER}/${REPO_NAME}/pull/${PULL_NUMBER}.patch
61-
# echo "Applying followng patch:"
62-
# cat ${PULL_NUMBER}.patch > ${ARTIFACT_DIR}/github-pr-${PULL_NUMBER}.patch
63-
# git apply ${PULL_NUMBER}.patch
64-
# fi
65-
#fi
66-
6788
popd
6889
## Point manifests repo uri in the KFDEF to the manifests in the PR
6990
pushd ~/kfdef

0 commit comments

Comments
 (0)