Incorporate review feedback : remove zz_unused and pkgk8scc routines

Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This commit is contained in:
Josh Kneubuhl 2022-05-20 09:04:34 -04:00
parent a7a470532c
commit d8540ee157
2 changed files with 0 additions and 113 deletions

View file

@ -126,19 +126,6 @@ function publish_chaincode_image() {
pop_fn
}
# Infer a reasonable name for the chaincode image based on the folder path conventions, or
# allow the user to override with TEST_NETWORK_CHAINCODE_IMAGE.
function zz_unused_set_chaincode_image() {
local cc_folder=$1
if [ -z "$TEST_NETWORK_CHAINCODE_IMAGE" ]; then
# cc_folder path starting with first index of "fabric-samples"
CHAINCODE_IMAGE=${cc_folder/*fabric-samples/fabric-samples}
else
CHAINCODE_IMAGE=${TEST_NETWORK_CHAINCODE_IMAGE}
fi
}
# Convenience routine to "do everything other than package and launch" a sample CC.
# When debugging a chaincode server, the process must be launched prior to completing
# the chaincode lifecycle at the peer. This routine provides a route for packaging

View file

@ -1,100 +0,0 @@
#!/bin/sh -l
#
# SPDX-License-Identifier: Apache-2.0
#
usage() {
echo "Usage: pkgk8scc.sh -l <label> -n <name> -d <digest> [-m <META-INF directory>]"
echo
echo " Creates a k8s chaincode package"
echo
echo " Flags:"
echo " -l <label> - chaincode label"
echo " -n <name> - docker image name"
echo " -d <digest> - docker image digest"
echo " -m <META-INF directory> - state database index definitions for CouchDB"
echo " -h - Print this message"
}
error_exit() {
echo "${1:-"Unknown Error"}" 1>&2
exit 1
}
while getopts "hl:n:d:m:" opt; do
case "$opt" in
h)
usage
exit 0
;;
l)
label=${OPTARG}
;;
n)
name=${OPTARG}
;;
d)
digest=${OPTARG}
;;
m)
metainf=${OPTARG}
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND-1))
if [ -z "$label" ] || [ -z "$name" ] || [ -z "$digest" ]; then
usage
exit 1
fi
if [ -n "$metainf" ]; then
metadir=$(basename "$metainf")
if [ "META-INF" != "$metadir" ]; then
error_exit "Invalid chaincode META-INF directory $metainf: directory name must be 'META-INF'"
elif [ ! -d "$metainf" ]; then
error_exit "Cannot find directory $metainf"
fi
fi
prefix=$(basename "$0")
tempdir=$(mktemp -d -t "$prefix.XXXXXXXX") || error_exit "Error creating temporary directory"
if [ -n "$DEBUG" ]; then
echo "label = $label"
echo "name = $name"
echo "digest = $digest"
echo "metainf = $metainf"
echo "tempdir = $tempdir"
fi
mkdir -p "$tempdir/src"
cat << IMAGEJSON-EOF > "$tempdir/src/image.json"
{
"name": "$name",
"digest": "$digest"
}
IMAGEJSON-EOF
if [ -n "$metainf" ]; then
cp -a "$metainf" "$tempdir/src/"
fi
mkdir -p "$tempdir/pkg"
cat << METADATAJSON-EOF > "$tempdir/pkg/metadata.json"
{
"type": "k8s",
"label": "$label"
}
METADATAJSON-EOF
tar -C "$tempdir/src" -czf "$tempdir/pkg/code.tar.gz" .
tar -C "$tempdir/pkg" -czf "$label.tgz" metadata.json code.tar.gz
rm -Rf "$tempdir"