From cb4355125f93ab339a813384f9b0cb1fb9904543 Mon Sep 17 00:00:00 2001 From: jkneubuh <86427252+jkneubuh@users.noreply.github.com> Date: Mon, 1 Aug 2022 09:58:12 -0400 Subject: [PATCH] Feature/ca v1.5.5 (#788) * bump CA to v1.5.5; Fabric to v2.4.4 Signed-off-by: Josh Kneubuhl * Reorganizes the kube test network environment default parameters to align on column boundaries. Signed-off-by: Josh Kneubuhl * Run k8s sample network tests against latest MAJOR.MINOR release of fabric, CA docker hub images. Signed-off-by: Josh Kneubuhl --- ci/scripts/run-k8s-test-network-basic.sh | 6 --- test-network-k8s/network | 64 ++++++++++++++---------- test-network-k8s/scripts/prereqs.sh | 3 +- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/ci/scripts/run-k8s-test-network-basic.sh b/ci/scripts/run-k8s-test-network-basic.sh index af87a8a8..2f6de991 100755 --- a/ci/scripts/run-k8s-test-network-basic.sh +++ b/ci/scripts/run-k8s-test-network-basic.sh @@ -12,12 +12,6 @@ export CLIENT_LANGUAGE=${CLIENT_LANGUAGE:-typescript} export CHAINCODE_LANGUAGE=${CHAINCODE_LANGUAGE:-java} export TEST_NETWORK_CHAINCODE_BUILDER=${CHAINCODE_BUILDER:-ccaas} -# Fabric version and Docker registry source: use the latest stable tag image from JFrog -export FABRIC_VERSION=${FABRIC_VERSION:-2.4} -export TEST_NETWORK_FABRIC_CONTAINER_REGISTRY=hyperledger-fabric.jfrog.io -export TEST_NETWORK_FABRIC_VERSION=amd64-${FABRIC_VERSION}-stable -export TEST_NETWORK_FABRIC_CA_VERSION=amd64-${FABRIC_VERSION}-stable - # test-network-k8s parameters export TEST_TAG=$(git describe) export TEST_NETWORK_KIND_CLUSTER_NAME=${TEST_NETWORK_KIND_CLUSTER_NAME:-kind} diff --git a/test-network-k8s/network b/test-network-k8s/network index b0904e9c..6fc280e9 100755 --- a/test-network-k8s/network +++ b/test-network-k8s/network @@ -17,37 +17,49 @@ set -o errexit # todo: allow relative paths for input arguments. cd "$(dirname "$0")" -export CLUSTER_RUNTIME=${TEST_NETWORK_CLUSTER_RUNTIME:-kind} # or k3s -export CONTAINER_CLI=${CONTAINER_CLI:-docker} # or nerdctl for containerd -export CONTAINER_NAMESPACE=${TEST_NETWORK_CONTAINER_NAMESPACE:-""} # or "--namespace k8s.io" for containerd / nerdctl +# Set an environment variable based on an optional override (TEST_NETWORK_${name}) +# from the calling shell. If the override is not available, assign the parameter +# to a default value. +function context() { + local name=$1 + local default_value=$2 + local override_name=TEST_NETWORK_${name} -export FABRIC_VERSION=${TEST_NETWORK_FABRIC_VERSION:-2.4.3} -export FABRIC_CA_VERSION=${TEST_NETWORK_FABRIC_CA_VERSION:-1.5.2} -export FABRIC_CONTAINER_REGISTRY=${TEST_NETWORK_FABRIC_CONTAINER_REGISTRY:-hyperledger} -export FABRIC_PEER_IMAGE=${TEST_NETWORK_FABRIC_PEER_IMAGE:-${FABRIC_CONTAINER_REGISTRY}/fabric-peer:${FABRIC_VERSION}} -export NETWORK_NAME=${TEST_NETWORK_NAME:-test-network} -export CLUSTER_NAME=${TEST_NETWORK_KIND_CLUSTER_NAME:-kind} -export NS=${TEST_NETWORK_KUBE_NAMESPACE:-${NETWORK_NAME}} -export DOMAIN=${TEST_NETWORK_DOMAIN:-vcap.me} -export CHANNEL_NAME=${TEST_NETWORK_CHANNEL_NAME:-mychannel} -export ORDERER_TIMEOUT=${TEST_NETWORK_ORDERER_TIMEOUT:-10s} # see https://github.com/hyperledger/fabric/issues/3372 -export TEMP_DIR=${PWD}/build -export CHAINCODE_BUILDER=${TEST_NETWORK_CHAINCODE_BUILDER:-ccaas} # see https://github.com/hyperledgendary/fabric-builder-k8s/blob/main/docs/TEST_NETWORK_K8S.md -export K8S_CHAINCODE_BUILDER_VERSION=${TEST_NETWORK_K8S_CHAINCODE_BUILDER_VERSION:-v0.6.0} + export ${name}="${!override_name:-${default_value}}" +} -LOG_FILE=${TEST_NETWORK_LOG_FILE:-network.log} -DEBUG_FILE=${TEST_NETWORK_DEBUG_FILE:-network-debug.log} -LOG_ERROR_LINES=${TEST_NETWORK_LOG_ERROR_LINES:-1} -LOCAL_REGISTRY_NAME=${TEST_NETWORK_LOCAL_REGISTRY_NAME:-kind-registry} -LOCAL_REGISTRY_PORT=${TEST_NETWORK_LOCAL_REGISTRY_PORT:-5000} -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} +context FABRIC_VERSION 2.4 +context FABRIC_CA_VERSION 1.5 +context CLUSTER_RUNTIME kind # or k3s for Rancher +context CONTAINER_CLI docker # or nerdctl for containerd +context CONTAINER_NAMESPACE "" # or "--namespace k8s.io" for containerd / nerdctl + +context FABRIC_CONTAINER_REGISTRY hyperledger +context FABRIC_PEER_IMAGE ${FABRIC_CONTAINER_REGISTRY}/fabric-peer:${FABRIC_VERSION} +context NETWORK_NAME test-network +context CLUSTER_NAME kind +context KUBE_NAMESPACE ${NETWORK_NAME} +context NS ${KUBE_NAMESPACE} +context DOMAIN vcap.me +context CHANNEL_NAME mychannel +context ORDERER_TIMEOUT 10s # see https://github.com/hyperledger/fabric/issues/3372 +context TEMP_DIR ${PWD}/build +context CHAINCODE_BUILDER ccaas # see https://github.com/hyperledgendary/fabric-builder-k8s/blob/main/docs/TEST_NETWORK_K8S.md +context K8S_CHAINCODE_BUILDER_VERSION v0.6.0 + +context LOG_FILE network.log +context DEBUG_FILE network-debug.log +context LOG_ERROR_LINE 1 +context LOCAL_REGISTRY_NAME kind-registry +context LOCAL_REGISTRY_PORT 5000 +context STAGE_DOCKER_IMAGES false +context NGINX_HTTP_PORT 80 +context NGINX_HTTPS_PORT 443 # todo: more complicated config, as these bleed into the yaml descriptors (sed? kustomize? helm (no)? tkn? ansible?...) or other script locations -TLSADMIN_AUTH=tlsadmin:tlsadminpw -RCAADMIN_AUTH=rcaadmin:rcaadminpw +context TLSADMIN_AUTH tlsadmin:tlsadminpw +context RCAADMIN_AUTH rcaadmin:rcaadminpw function print_help() { set +x diff --git a/test-network-k8s/scripts/prereqs.sh b/test-network-k8s/scripts/prereqs.sh index 032179a6..7e7c2a3e 100755 --- a/test-network-k8s/scripts/prereqs.sh +++ b/test-network-k8s/scripts/prereqs.sh @@ -46,7 +46,8 @@ function check_prereqs() { bin/peer version &> /dev/null if [[ $? -ne 0 ]]; then echo "Downloading LATEST Fabric binaries and config" - curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh | bash -s -- -s -d + curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh \ + | bash -s -- -s -d # remove sample config files extracted by the installation script rm config/configtx.yaml