fabric-samples/full-stack-asset-transfer-guide/tests/30-ansible-e2e.sh
jkneubuh a299e18e26
Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852)
* Import Full Stack Asset Transfer Guide at commit fb554befdbbeff9e69159b54fce0b811603f29c7

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* Update the workshop with a new WORKSHOP_PATH under fabric-samples

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* Update the workshop with a new WORKSHOP_PATH under fabric-samples

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* missed a .git ignored directory on add

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* Updates to run the workshop on the Apple M1

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* Workaround for https://github.com/eslint/eslint/issues/15299 in the contract tslinter

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* Build an arch-specific CC images on M1

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* empty commit - force a build

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

* revert an accidental commit that was building the top-level asset-transfer as arm64

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
2022-11-10 10:40:27 -05:00

113 lines
3 KiB
Bash
Executable file

#!/bin/bash
set -v -eou pipefail
# All tests run in the workshop root folder
cd "$(dirname "$0")"/..
# Clean house on exit
function exitHook() {
# Just in case the just left some bits running around
kind delete cluster --name kind
# Just in case ...
if docker inspect kind-registry &>/dev/null; then
echo "Stopping container registry"
docker kill kind-registry
docker rm kind-registry
fi
# Delete the sample network configuration and crypto material
rm -rf "${WORKSHOP_PATH}"/_cfg
}
trap exitHook SIGINT SIGTERM EXIT
###############################################################################
# 00-setup
###############################################################################
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- binary
export WORKSHOP_PATH="${PWD}"
export PATH="${WORKSHOP_PATH}/bin:${PATH}"
export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config"
"${WORKSHOP_PATH}/check.sh"
###############################################################################
# 10-kube
###############################################################################
# env checks
[[ ${WORKSHOP_PATH+x} ]] || exit 1
[[ ${FABRIC_CFG_PATH+x} ]] || exit 1
just check-setup
# Set the ingress domain and target k8s namespace
export WORKSHOP_INGRESS_DOMAIN=localho.st
export WORKSHOP_NAMESPACE=fabricinfra
# Create a Kubernetes cluster in Docker, configure an Nginx ingress, and docker container registry
just kind
# KIND will set the current kube client context in ~/.kube/config
kubectl cluster-info
# Run k9s to observe the target namespace
# k9s -n $WORKSHOP_NAMESPACE
###############################################################################
# 20-fabric
###############################################################################
# Clear out any certs from a prior run, just in case
rm -rf ${WORKSHOP_PATH}/_cfg
just check-kube
# env checks
[[ ${WORKSHOP_PATH+x} ]] || exit 1
[[ ${FABRIC_CFG_PATH+x} ]] || exit 1
[[ ${WORKSHOP_INGRESS_DOMAIN+x} ]] || exit 1
[[ ${WORKSHOP_NAMESPACE+x} ]] || exit 1
# check Nginx ingress
kubectl -n ingress-nginx get all
kubectl -n ingress-nginx get deployment.apps/ingress-nginx-controller
curl http://${WORKSHOP_INGRESS_DOMAIN}
curl --insecure https://${WORKSHOP_INGRESS_DOMAIN}:443
# Bring up the operator and console
just ansible-review-config
just ansible-ingress
just ansible-operator
just ansible-console
# Bring up the fabric network with ansible
# Unfortunately, the GHA executors do not have enough RAM to run the full network setup.
# We can at least check that the operator and console came up OK.
# just ansible-network
# Operator running?
kubectl -n ${WORKSHOP_NAMESPACE} get deployment fabric-operator
# Console running?
kubectl -n ${WORKSHOP_NAMESPACE} get deployment hlf-console
# Console listening at the Nginx ingress?
curl --fail --insecure https://${WORKSHOP_NAMESPACE}-hlf-console-console.${WORKSHOP_INGRESS_DOMAIN}/