Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .catalog-onboard-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ offerings:
- name: fully-configurable
mark_ready: true
install_type: fullstack
pre_validation: "tests/scripts/pre-validation-deploy-cloud-logs.sh"
post_validation: "tests/scripts/post-validation-destroy-cloud-logs.sh"
scc:
instance_id: 1c7d5f78-9262-44c3-b779-b28fe4d88c37
region: us-south
Expand Down
19 changes: 19 additions & 0 deletions tests/scripts/post-validation-destroy-cloud-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

#############################################################################################################
# This script is used by the catalog pipeline to destroy the COS instance and VPC, which were provisioned #
# as prerequisites for the fully configurable OCP VPC cluster that is published to the catalog. #
#############################################################################################################

set -e

TERRAFORM_SOURCE_DIR="tests/resources"
TF_VARS_FILE="terraform.tfvars"

(
cd "${TERRAFORM_SOURCE_DIR}"
echo "Destroying pre-requisite Cloud Logs instance..."
terraform destroy -input=false -auto-approve -var-file="${TF_VARS_FILE}" || exit 1

echo "Post-validation completed successfully."
)
39 changes: 39 additions & 0 deletions tests/scripts/pre-validation-deploy-cloud-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

############################################################################################################
## This script is used by the catalog pipeline to deploy the Cloud Logs instance
## which are the prerequisites for the fully-configurable AT Event Routing DA.
############################################################################################################

set -e

DA_DIR="solutions/fully-configurable"
TERRAFORM_SOURCE_DIR="tests/resources"
JSON_FILE="${DA_DIR}/catalogValidationValues.json"
TF_VARS_FILE="terraform.tfvars"

(
cwd=$(pwd)
cd ${TERRAFORM_SOURCE_DIR}
echo "Provisioning pre-requisite Cloud Logs instance .."
terraform init || exit 1

# $VALIDATION_APIKEY is available in the catalog runtime
{
echo "ibmcloud_api_key=\"${VALIDATION_APIKEY}\""
echo "prefix=\"at-$(openssl rand -hex 2)\""
} >> ${TF_VARS_FILE}
terraform apply -input=false -auto-approve -var-file=${TF_VARS_FILE} || exit 1

existing_cloud_logs_instance_crn="existing_cloud_logs_instance_crn"
existing_cloud_logs_instance_value=$(terraform output -state=terraform.tfstate -raw icl_crn)

echo "Appending '${existing_cloud_logs_instance_crn}' input variable values to ${JSON_FILE}.."

cd "${cwd}"
jq -r --arg existing_cloud_logs_instance_crn "${existing_cloud_logs_instance_crn}" \
--arg existing_cloud_logs_instance_value "${existing_cloud_logs_instance_value}" \
'. + {($existing_cloud_logs_instance_crn): $existing_cloud_logs_instance_value}' "${JSON_FILE}" > tmpfile && mv tmpfile "${JSON_FILE}" || exit 1

echo "Pre-validation completed successfully."
)