-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Michael Valdron <[email protected]>
- Loading branch information
1 parent
efa684d
commit e2125ed
Showing
3 changed files
with
100 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright Red Hat | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# only exit with zero if all commands of the pipeline exit successfully | ||
set -o pipefail | ||
# error on unset variables | ||
set -u | ||
# print each command before executing it | ||
set -x | ||
|
||
# Disable telemtry for odo | ||
export ODO_DISABLE_TELEMETRY=true | ||
|
||
# Split the registry image and image tag from the REGISTRY_IMAGE env variable | ||
IMG="$(echo $REGISTRY_IMAGE | cut -d':' -f1)" | ||
TAG="$(echo $REGISTRY_IMAGE | cut -d':' -f2)" | ||
|
||
# Set namespace | ||
NAMESPACE=${NAMESPACE:-'devfile-registry-test'} | ||
|
||
# Fail if odo is not installed | ||
if [ -z $(command -v odo 2> /dev/null) ]; then | ||
echo "install odo." | ||
exit 1 | ||
fi | ||
|
||
# Create testing namespace if does not exist | ||
odo create namespace ${NAMESPACE} | ||
|
||
# Deploy devfile registry using odo v3 | ||
odo deploy --var hostName=${NAMESPACE}.$(minikube ip).nip.io \ | ||
--var hostAlias=${NAMESPACE}.$(minikube ip).nip.io \ | ||
--var indexImageName=$IMG \ | ||
--var indexImageTag=$TAG | ||
|
||
# Wait for deployment to be ready | ||
kubectl wait deploy/devfile-registry --for=condition=Available --timeout=600s | ||
|
||
# Get status code, retry for 30 seconds until status code is 200 otherwise fail | ||
STATUS_CODE=$(curl --fail --retry-max-time 30 -o /dev/null -s -w "%{http_code}\n" "http://${NAMESPACE}.$(minikube ip).nip.io/health") | ||
if [ ${STATUS_CODE} -ne 200 ]; then | ||
echo "unexpected status code ${STATUS_CODE}, was expecting 200" | ||
|
||
odo delete component --name devfile-registry-community --force | ||
|
||
exit 1 | ||
else | ||
odo delete component --name devfile-registry-community --force | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters