From 8298dc10ea40fb0a5a97c6f73112c3485e4b92bf Mon Sep 17 00:00:00 2001 From: Marc Gueury Date: Fri, 30 Jun 2023 14:08:54 +0200 Subject: [PATCH 1/2] v1.6 --- basis/bin/add_api.sh | 2 +- basis/bin/auto_env.sh | 6 ++---- basis/bin/done.sh | 4 +++- basis/bin/gen_auth_token.sh | 1 - basis/build.sh | 4 ++++ basis/destroy.sh | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/basis/bin/add_api.sh b/basis/bin/add_api.sh index d90d4cc3..9c5f0747 100755 --- a/basis/bin/add_api.sh +++ b/basis/bin/add_api.sh @@ -13,7 +13,7 @@ if [ "$APIM_HOST" != "" ]; then get_ui_url if [ -f src/oke/ingress-app.yaml ]; then ENDPOINT_GIT=src/oke/ingress-app.yaml + curl -k "https://${APIM_HOST}/ords/apim/rest/add_api?git_repo_url=${TF_VAR_git_url}&impl_name=${FIRST_LETTER_UPPERCASE}&icon_url=${TF_VAR_language}&runtime_console=https://cloud.oracle.com/api-gateway/gateways/$TF_VAR_apigw_ocid/deployments/$APIGW_DEPLOYMENT_OCID&version=${GIT_BRANCH}&endpoint_url=${UI_URL}/app/dept&endpoint_git_path=${ENDPOINT_GIT}&spec_git_path=src/app/openapi_spec.yaml&spec_type=OpenAPI" fi - curl -k "https://${APIM_HOST}/ords/apim/rest/add_api?git_repo_url=${TF_VAR_git_url}&impl_name=${FIRST_LETTER_UPPERCASE}&icon_url=${TF_VAR_language}&runtime_console=https://cloud.oracle.com/api-gateway/gateways/$TF_VAR_apigw_ocid/deployments/$APIGW_DEPLOYMENT_OCID&version=${GIT_BRANCH}&endpoint_url=${UI_URL}/app/dept&endpoint_git_path=${ENDPOINT_GIT}&spec_git_path=src/app/openapi_spec.yaml&spec_type=OpenAPI" fi fi \ No newline at end of file diff --git a/basis/bin/auto_env.sh b/basis/bin/auto_env.sh index 92c900ff..d4086bd2 100755 --- a/basis/bin/auto_env.sh +++ b/basis/bin/auto_env.sh @@ -35,7 +35,7 @@ if declare -p | grep -q "__TO_FILL__"; then echo echo "Edit the file env.sh. Some variables needs to be filled:" cat env.sh | grep __TO_FILL__ - exit + exit 1 fi if ! command -v jq &> /dev/null; then @@ -198,9 +198,7 @@ if [ -f $STATE_FILE ]; then fi # Compute - if [ "$TF_VAR_deploy_strategy" == "compute" ]; then - get_attribute_from_tfstate "COMPUTE_IP" "starter_instance" "public_ip" - fi + get_attribute_from_tfstate "COMPUTE_IP" "starter_instance" "public_ip" # Bastion get_attribute_from_tfstate "BASTION_IP" "starter_bastion" "public_ip" diff --git a/basis/bin/done.sh b/basis/bin/done.sh index 3311e69c..696d1f06 100755 --- a/basis/bin/done.sh +++ b/basis/bin/done.sh @@ -62,4 +62,6 @@ if [ ! -z "$UI_URL" ]; then fi fi - +if [ -f $ROOT_DIR/src/after_done.sh ]; then + $ROOT_DIR/src/after_done.sh +fi \ No newline at end of file diff --git a/basis/bin/gen_auth_token.sh b/basis/bin/gen_auth_token.sh index 396b1c57..6f6cf317 100755 --- a/basis/bin/gen_auth_token.sh +++ b/basis/bin/gen_auth_token.sh @@ -8,7 +8,6 @@ export ROOT_DIR=${BIN_DIR%/*} if grep -q 'TF_VAR_auth_token="__TO_FILL__"' $ROOT_DIR/env.sh; then echo "Generating a new AUTH_TOKEN" get_user_details - echo TF_VAR_user_ocid=$TF_VAR_user_ocid oci iam auth-token create --description "OCI_STARTER_TOKEN" --user-id $TF_VAR_user_ocid > auth_token.log 2>&1 export TF_VAR_auth_token=`cat auth_token.log | jq -r '.data.token'` diff --git a/basis/build.sh b/basis/build.sh index 2728fa88..4732a16b 100755 --- a/basis/build.sh +++ b/basis/build.sh @@ -4,4 +4,8 @@ export TARGET_DIR=$ROOT_DIR/target cd $ROOT_DIR mkdir -p $TARGET_DIR + +# Show the log and save it in target/build.log bin/build_all.sh $@ 2>&1 | tee $TARGET_DIR/build.log +# Return the exit code of build_all.sh +exit ${PIPESTATUS[0]} \ No newline at end of file diff --git a/basis/destroy.sh b/basis/destroy.sh index 0d943a85..f3ec64a1 100755 --- a/basis/destroy.sh +++ b/basis/destroy.sh @@ -3,4 +3,4 @@ export ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && p export TARGET_DIR=$ROOT_DIR/target cd $ROOT_DIR -bin/destroy_all.sh $@ 2>&1 | tee $TARGET_DIR/destroy.log \ No newline at end of file +. bin/destroy_all.sh $@ 2>&1 | tee $TARGET_DIR/destroy.log From e37e5cd7bd69e8dc520307b3ad56f5e168880896 Mon Sep 17 00:00:00 2001 From: Marc Gueury Date: Fri, 30 Jun 2023 14:09:51 +0200 Subject: [PATCH 2/2] v1.6 --- basis/destroy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/destroy.sh b/basis/destroy.sh index f3ec64a1..dfc61642 100755 --- a/basis/destroy.sh +++ b/basis/destroy.sh @@ -3,4 +3,4 @@ export ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && p export TARGET_DIR=$ROOT_DIR/target cd $ROOT_DIR -. bin/destroy_all.sh $@ 2>&1 | tee $TARGET_DIR/destroy.log +bin/destroy_all.sh $@ 2>&1 | tee $TARGET_DIR/destroy.log