Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from toolforge/pr/14
Browse files Browse the repository at this point in the history
follow up patch: default to prod when no parameters are passed
  • Loading branch information
NdibeRaymond committed Jan 18, 2023
2 parents 0bab90f + 2a164fc commit 9089ddb
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions deploy.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -o errexit
set -o nounset
set -o pipefail


help() {
cat <<EOH
Usage: $0 [OPTIONS] <ENVIRONMENT>
Expand All @@ -10,10 +12,27 @@ help() {
-v Show verbose output.
EOH
}


check_environment() {
# verify that the proper environment is passed
local environment="${1?No environment passed}"

if [[ ! -d "deploy/$environment" || "$environment" =~ ^(base|README)$ ]]; then
echo "Unknown environment $environment, use one of:"
ls deploy/ | egrep -v '^(base|README)'
exit 1
fi
}


deploy_generic() {

sed "s/{{HARBOR_IP}}/${HARBOR_IP}/"\
deploy/$environment/auth-patch.yaml.template > deploy/$environment/auth-patch.yaml
local environment="${1?No environment passed}"

if [[ "$environment" == "devel" ]]; then
sed "s/{{HARBOR_IP}}/${HARBOR_IP}/"\
deploy/devel/auth-patch.yaml.template > deploy/devel/auth-patch.yaml
fi

if command -v minikube >/dev/null; then
kubectl="minikube kubectl --"
Expand All @@ -24,6 +43,8 @@ deploy_generic() {
$kubectl apply -k "deploy/base-tekton"
$kubectl apply -k "deploy/$environment"
}


main () {
while getopts "hv" option; do
case "${option}" in
Expand Down Expand Up @@ -51,11 +72,9 @@ main () {
environment="${1:-}"
fi

if [[ ! -d "deploy/$environment" || "$environment" =~ ^(base|README)$ ]]; then
echo "Unknown environment $environment, use one of:"
ls deploy/ | egrep -v '^(base|README)'
exit 1
fi
check_environment "$environment"
deploy_generic "$environment"
}


main "$@"

0 comments on commit 9089ddb

Please sign in to comment.