-
Notifications
You must be signed in to change notification settings - Fork 98
Modifications for k8s to run #892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
3ea5cd4
ed510e2
35c6589
6416cbc
7b20038
f163fa8
2e820f5
274e399
d16b7bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,19 @@ | |
| # Copyright IBM Corp. All Rights Reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| C_RESET='\033[0m' | ||
| C_RED='\033[0;31m' | ||
| C_GREEN='\033[0;32m' | ||
| C_BLUE='\033[0;34m' | ||
| C_YELLOW='\033[1;33m' | ||
| # successln echos in green color | ||
| function successln() { | ||
| println "${C_GREEN}${1}${C_RESET}" | ||
| } | ||
|
Comment on lines
+6
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like a bit of color :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are just using green in this script? |
||
| # println echos string | ||
| function println() { | ||
| echo -e "$1" | ||
| } | ||
| set -euo pipefail | ||
|
|
||
| if [[ -z "${FPC_PATH}" ]]; then | ||
|
|
@@ -19,9 +32,10 @@ cryptoConfigDir="${outDir}/crypto-config" | |
| channelArtifactsDir="${outDir}/channel-artifacts" | ||
| packageDir="${outDir}/packages" | ||
|
|
||
|
|
||
| CHAINCODE_SERVER_PORT=9999 | ||
|
|
||
| FABRIC_BIN_DIR="${FABRIC_BIN_DIR:-${FABRIC_PATH}/build/bin}" | ||
| FABRIC_BIN_DIR="${FPC_PATH}/fabric/_internal/bin" | ||
|
Comment on lines
-24
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be better |
||
| if [[ -z "${FABRIC_BIN_DIR}" ]]; then | ||
| echo "Error: FABRIC_BIN_DIR not set" | ||
| echo "Error: FABRIC_BIN_DIR must point to the location of cryptogen and configtxgen" | ||
|
|
@@ -32,9 +46,9 @@ CRYPPTOGEN_CMD="${FABRIC_BIN_DIR}/cryptogen" | |
| CONFIGTXGEN_CMD="${FABRIC_BIN_DIR}/configtxgen" | ||
|
|
||
| echo "Clean existing deployment artifacts" | ||
| rm -rf ${cryptoConfigDir} | ||
| rm -rf ${channelArtifactsDir} | ||
| rm -rf ${packageDir} | ||
| rm -rf $cryptoConfigDir | ||
| rm -rf $channelArtifactsDir | ||
| rm -rf $packageDir | ||
|
Comment on lines
-35
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we are not really have a strong consistent use of variable with an without |
||
|
|
||
| echo "Generate crypto material for orgs" | ||
| $CRYPPTOGEN_CMD generate --output=${cryptoConfigDir} --config=./crypto-config.yaml | ||
|
|
@@ -54,7 +68,44 @@ do | |
| done | ||
|
|
||
| echo "Package ercc and fpccc" | ||
| CC_TYPE="external" | ||
| function packageChaincode() { | ||
|
|
||
| address="{{.peername}}_${CC_NAME}_ccaas:${CHAINCODE_SERVER_PORT}" | ||
| prefix=$(basename "$0") | ||
| tempdir=$(mktemp -d -t "$prefix.XXXXXXXX") || error_exit "Error creating temporary directory" | ||
| label=${CC_NAME}_${CC_VERSION} | ||
| mkdir -p "$tempdir/src" | ||
|
|
||
| cat > "$tempdir/src/connection.json" <<CONN_EOF | ||
| { | ||
| "address": "${address}", | ||
| "dial_timeout": "10s", | ||
| "tls_required": false | ||
| } | ||
| CONN_EOF | ||
|
|
||
| mkdir -p "$tempdir/pkg" | ||
|
|
||
| cat << METADATA-EOF > "$tempdir/pkg/metadata.json" | ||
| { | ||
| "type": "ccaas", | ||
| "label": "$label" | ||
| } | ||
| METADATA-EOF | ||
|
|
||
| tar -C "$tempdir/src" -czf "$tempdir/pkg/code.tar.gz" . | ||
| tar -C "$tempdir/pkg" -czf "$CC_NAME-$peer.tar.gz" metadata.json code.tar.gz | ||
| rm -Rf "$tempdir" | ||
|
|
||
| # PACKAGE_ID=$(peer lifecycle chaincode calculatepackageid ${CC_NAME}.tar.gz) | ||
| # commenting due to the network not yet being setup to calculate package_id | ||
|
|
||
| mv $CC_NAME-$1.tar.gz $packageDir | ||
| successln "Chaincode is packaged ${address} and in ${packageDir}/${CC_NAME}-${1}.tar.gz" | ||
|
|
||
| } | ||
|
|
||
| CC_TYPE="ccaas" | ||
| ERCC_ID="ercc" | ||
| ERCC_VER="1.0" | ||
| FPCCC_ID="fpccc" | ||
|
|
@@ -66,19 +117,25 @@ if [[ -z "${TEST_CC_PATH}" ]]; then | |
| fi | ||
|
|
||
| FPC_MRENCLAVE="$(cat "${FPCCC_PATH}"/_build/lib/mrenclave)" | ||
|
|
||
| mkdir $packageDir | ||
| for peer in $(shopt -s globstar; find ${cryptoConfigDir}/**/peers/ -mindepth 1 -maxdepth 1 -execdir echo {} ';' | sed 's/^\.\///g'); | ||
| do | ||
| # ercc | ||
| endpoint="${ERCC_ID}-${peer}:${CHAINCODE_SERVER_PORT}" | ||
| packageName="${ERCC_ID}-${peer}.tgz" | ||
| packageChaincode "${packageDir}" "${packageName}" "${ERCC_ID}" "${ERCC_VER}" "${CC_TYPE}" "${endpoint}" "${peer}" | ||
| CC_NAME="${ERCC_ID}" | ||
| CC_VERSION=$ERCC_VER | ||
| # endpoint="${ERCC_ID}-${peer}:${CHAINCODE_SERVER_PORT}" | ||
| # packageName="${ERCC_ID}-${peer}.tgz" | ||
| # packageChaincode "${packageDir}" "${packageName}" "${ERCC_ID}" "${ERCC_VER}" "${CC_TYPE}" "${endpoint}" "${peer}" | ||
| packageChaincode "${peer}" | ||
|
|
||
| # fpc cc | ||
| endpoint="${FPCCC_ID}-${peer}:${CHAINCODE_SERVER_PORT}" | ||
| packageName="${FPCCC_ID}-${peer}.tgz" | ||
| packageChaincode "${packageDir}" "${packageName}" "${FPCCC_ID}" "${FPC_MRENCLAVE}" "${CC_TYPE}" "${endpoint}" "${peer}" | ||
| CC_NAME="${FPCCC_ID}" | ||
| # endpoint="${FPCCC_ID}-${peer}:${CHAINCODE_SERVER_PORT}" | ||
| # packageName="${FPCCC_ID}-${peer}.tgz" | ||
| # packageChaincode "${packageDir}" "${packageName}" "${FPCCC_ID}" "${FPC_MRENCLAVE}" "${CC_TYPE}" "${endpoint}" "${peer}" | ||
| packageChaincode "${peer}" | ||
| done | ||
|
|
||
|
|
||
| echo "Store mrenclave for fpccc" | ||
| echo "FPC_MRENCLAVE=${FPC_MRENCLAVE}" >> ${packageDir}/chaincode-config.properties | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update our minicube version as well in order to use
image loadinstead ofcache add?