Address Issue #511 with docs and better error handling (#533)

* Address Issue #511 with docs and better error handling

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

* Set the TEST_NETWORK_FABRIC_VERSION in documentation for local development.

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This commit is contained in:
jkneubuh 2021-11-19 11:09:58 -05:00 committed by GitHub
parent d19a7e4b02
commit ab19b8e01d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 5 deletions

View file

@ -131,8 +131,45 @@ to Pods deployed to the local cluster.
For dev/test/CI based flows using an external registry, the traditional Kubernetes practice of
[Adding ImagePullSecrets to a service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)
still applies.
still applies.
In some environments, KIND may encounter issues loading the Fabric docker images from the public container
registries. In addition, for Fabric development it can be advantageous to work with Docker images built
locally, bypassing the public images entirely. For these scenarios, images may also be [directly loaded](https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster)
into the KIND image plane, bypassing the container registry.
The `./network` script supports these additional modes via:
1. For network-constrained environments, pull all images to the local docker cache and load to KIND:
```shell
export TEST_NETWORK_STAGE_DOCKER_IMAGES=true
./network kind
./network up
```
2. For alternate registries (e.g. local or Fabric CI/CD builds):
```shell
./network kind
export TEST_NETWORK_FABRIC_CONTAINER_REGISTRY=hyperledger-fabric.jfrog.io
export TEST_NETWORK_FABRIC_VERSION=amd64-latest
export TEST_NETWORK_FABRIC_CA_VERSION=amd64-latest
./network up
```
3. For working with Fabric images built locally:
```shell
./network kind
make docker # in hyperledger/fabric
export TEST_NETWORK_FABRIC_VERSION=2.4.0
./network load-images
./network up
```
## Cloud Vendors

View file

@ -35,7 +35,7 @@ STAGE_DOCKER_IMAGES=${TEST_NETWORK_STAGE_DOCKER_IMAGES:-false}
NGINX_HTTP_PORT=${TEST_NETWORK_INGRESS_HTTP_PORT:-80}
NGINX_HTTPS_PORT=${TEST_NETWORK_INGRESS_HTTPS_PORT:-443}
CHAINCODE_NAME=${TEST_NETWORK_CHAINCODE_NAME:-asset-transfer-basic}
CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE:-localhost:5000/fabric-ccaas-asset-transfer-basic}
CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE:-ghcr.io/hyperledgendary/fabric-ccaas-asset-transfer-basic:latest}
CHAINCODE_LABEL=${TEST_NETWORK_CHAINCODE_LABEL:-basic_1.0}
# todo: more complicated config, as these bleed into the yaml descriptors (sed? kustomize? helm (no)? tkn? ansible?...) or other script locations
@ -59,6 +59,7 @@ function print_help() {
log "--- Cluster Information"
log "Cluster name \t\t: ${CLUSTER_NAME}"
log "Cluster namespace \t: ${NS}"
log "Fabric Registry \t: ${FABRIC_CONTAINER_REGISTRY}"
log "Local Registry \t\t: ${LOCAL_REGISTRY_NAME}"
log "Local Registry port \t: ${LOCAL_REGISTRY_PORT}"
log "nginx http port \t: ${NGINX_HTTP_PORT}"
@ -70,6 +71,7 @@ function print_help() {
log
echo todo: help output, parse mode, flags, env, etc.
}

View file

@ -154,7 +154,8 @@ function invoke_chaincode() {
# Normally the chaincode ID is emitted by the peer install command. In this case, we'll generate the
# package ID as the sha-256 checksum of the chaincode archive.
function set_chaincode_id() {
local cc_sha256=$(shasum -a 256 build/chaincode/${CHAINCODE_NAME}.tgz | tr -s ' ' | cut -d ' ' -f 1)
local cc_package=build/chaincode/${CHAINCODE_NAME}.tgz
cc_sha256=$(shasum -a 256 ${cc_package} | tr -s ' ' | cut -d ' ' -f 1)
CHAINCODE_ID=${CHAINCODE_LABEL}:${cc_sha256}
}

View file

@ -47,11 +47,14 @@ function log() {
function pop_fn() {
# echo exiting ${FUNCNAME[1]}
local res=$1
if [ $# -eq 0 ]; then
echo -ne "\r✅" >> ${LOG_FILE}
echo "" >> ${LOG_FILE}
return
fi
elif [ $res -eq 0 ]; then
local res=$1
if [ $res -eq 0 ]; then
echo -ne "\r✅" >> ${LOG_FILE}
elif [ $res -eq 1 ]; then
@ -60,6 +63,9 @@ function pop_fn() {
elif [ $res -eq 2 ]; then
echo -ne "\r☠" >> ${LOG_FILE}
elif [ $res -eq 127 ]; then
echo -ne "\r☠" >> ${LOG_FILE}
else
echo -ne "\r" >> ${LOG_FILE}
fi