From fef100c471191f4c691f7282fc4e04501ea0f652 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Thu, 3 Feb 2022 09:25:20 -0500 Subject: [PATCH 1/6] Fix Docker build on ARM Signed-off-by: Nicko Guyer --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a89b4e027..975838d4bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,8 @@ RUN mkdir /firefly/frontend \ ADD . . RUN make build -FROM golang:1.16-alpine3.13 AS fabric-builder -RUN apk add libc6-compat +FROM golang@sha256:bab81aadc644eee23bafdf479e9bd60c418d405dbc79370ababbb2a2f88d8034 AS fabric-builder +RUN apk add libc6-compat WORKDIR /firefly/smart_contracts/fabric/firefly-go ADD smart_contracts/fabric/firefly-go . RUN GO111MODULE=on go mod vendor @@ -21,6 +21,7 @@ RUN touch core.yaml RUN ./bin/peer lifecycle chaincode package /firefly/smart_contracts/fabric/firefly-go/firefly_fabric.tar.gz --path /firefly/smart_contracts/fabric/firefly-go --lang golang --label firefly_1.0 FROM node:14-alpine3.11 AS solidity-builder +RUN apk add python alpine-sdk WORKDIR /firefly/solidity_firefly ADD smart_contracts/ethereum/solidity_firefly/package*.json . RUN npm install From c6d46c210207940766518dc7c0abfb99fc31114d Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Mon, 7 Feb 2022 11:26:47 -0500 Subject: [PATCH 2/6] Parameterize docker build Signed-off-by: Nicko Guyer --- Dockerfile | 20 +++++--- Makefile | 2 + docker_build.sh | 47 +++++++++++++++++++ manifest.json | 26 +++++++++- manifestgen.sh | 20 +++++--- .../ethereum/solidity_firefly/package.json | 2 +- .../solidity_firefly/truffle-config.js | 2 +- test/e2e/run.sh | 3 +- 8 files changed, 104 insertions(+), 18 deletions(-) create mode 100755 docker_build.sh diff --git a/Dockerfile b/Dockerfile index 975838d4bf..5adc499de6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,23 @@ -FROM golang:1.16-alpine3.13 AS firefly-builder +ARG FIREFLY_BUILDER_TAG +ARG FABRIC_BUILDER_TAG +ARG FABRIC_BUILDER_PLATFORM +ARG SOLIDITY_BUILDER_TAG +ARG BASE_TAG + +FROM $FIREFLY_BUILDER_TAG AS firefly-builder +ARG UI_TAG +ARG UI_RELEASE RUN apk add make gcc build-base curl git WORKDIR /firefly ADD go.mod go.sum ./ RUN go mod download -ENV UI_RELEASE "https://github.com/hyperledger/firefly-ui/releases/download/v0.5.0/v0.5.0_8cb358c.tgz" +ENV UI_RELEASE https://github.com/hyperledger/firefly-ui/releases/download/$UI_TAG/$UI_RELEASE.tgz RUN mkdir /firefly/frontend \ && curl -sLo - $UI_RELEASE | tar -C /firefly/frontend -zxvf - ADD . . RUN make build -FROM golang@sha256:bab81aadc644eee23bafdf479e9bd60c418d405dbc79370ababbb2a2f88d8034 AS fabric-builder +FROM --platform=$FABRIC_BUILDER_PLATFORM $FABRIC_BUILDER_TAG AS fabric-builder RUN apk add libc6-compat WORKDIR /firefly/smart_contracts/fabric/firefly-go ADD smart_contracts/fabric/firefly-go . @@ -20,8 +28,8 @@ RUN tar -zxf hyperledger-fabric-linux-amd64-2.3.2.tar.gz RUN touch core.yaml RUN ./bin/peer lifecycle chaincode package /firefly/smart_contracts/fabric/firefly-go/firefly_fabric.tar.gz --path /firefly/smart_contracts/fabric/firefly-go --lang golang --label firefly_1.0 -FROM node:14-alpine3.11 AS solidity-builder -RUN apk add python alpine-sdk +FROM $SOLIDITY_BUILDER_TAG AS solidity-builder +RUN apk add python3 make gcc g++ musl-dev WORKDIR /firefly/solidity_firefly ADD smart_contracts/ethereum/solidity_firefly/package*.json . RUN npm install @@ -29,7 +37,7 @@ RUN npm config set user 0 ADD smart_contracts/ethereum/solidity_firefly . RUN npx truffle compile -FROM alpine:latest +FROM $BASE_TAG WORKDIR /firefly COPY --from=firefly-builder /firefly/firefly ./firefly COPY --from=firefly-builder /firefly/frontend/ /firefly/frontend/ diff --git a/Makefile b/Makefile index d66ed469aa..4d8c7924c2 100644 --- a/Makefile +++ b/Makefile @@ -89,3 +89,5 @@ swagger: $(VGO) test ./internal/apiserver -timeout=10s -tags swagger manifest: ./manifestgen.sh +docker: + ./docker_build.sh \ No newline at end of file diff --git a/docker_build.sh b/docker_build.sh new file mode 100755 index 0000000000..e813e73a81 --- /dev/null +++ b/docker_build.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Copyright © 2022 Kaleido, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script will automatically update the manifest.json file with the +# latest releases of all FireFly microservice dependencies + +FIREFLY_BUILDER_TAG=$(cat manifest.json | jq -r '.build."firefly-builder".image') +FABRIC_BUILDER_TAG=$(cat manifest.json | jq -r '.build."fabric-builder".image') +FABRIC_BUILDER_PLATFORM=$(cat manifest.json | jq -r '.build."fabric-builder".platform') +SOLIDITY_BUILDER_TAG=$(cat manifest.json | jq -r '.build."solidity-builder".image') +BASE_TAG=$(cat manifest.json | jq -r '.build.base.image') +UI_TAG=$(cat manifest.json | jq -r '.ui.tag') +UI_RELEASE=$(cat manifest.json | jq -r '.ui.release') + +echo FIREFLY_BUILDER_TAG=$FIREFLY_BUILDER_TAG +echo FABRIC_BUILDER_TAG=$FABRIC_BUILDER_TAG +echo FABRIC_BUILDER_PLATFORM=$FABRIC_BUILDER_PLATFORM +echo SOLIDITY_BUILDER_TAG=$SOLIDITY_BUILDER_TAG +echo BASE_TAG=$BASE_TAG +echo UI_TAG=$UI_TAG +echo UI_RELEASE=$UI_RELEASE + +docker build \ + -t hyperledger/firefly \ + --build-arg FIREFLY_BUILDER_TAG=$FIREFLY_BUILDER_TAG \ + --build-arg FABRIC_BUILDER_TAG=$FABRIC_BUILDER_TAG \ + --build-arg FABRIC_BUILDER_PLATFORM=$FABRIC_BUILDER_PLATFORM \ + --build-arg SOLIDITY_BUILDER_TAG=$SOLIDITY_BUILDER_TAG \ + --build-arg BASE_TAG=$BASE_TAG \ + --build-arg UI_TAG=$UI_TAG \ + --build-arg UI_RELEASE=$UI_RELEASE \ + . \ No newline at end of file diff --git a/manifest.json b/manifest.json index c664f8b2f1..eaa2fc51b8 100644 --- a/manifest.json +++ b/manifest.json @@ -21,7 +21,29 @@ }, "tokens-erc20-erc721": { "image": "ghcr.io/hyperledger/firefly-tokens-erc20-erc721", - "tag": "v0.1.4", - "sha": "6de65db8dfe322e6244bbd787c10406007a88049d749b5045065163c66d612eb" + "tag": "v0.1.5", + "sha": "dbd7b2c81ec80b6158eaa66e84e3dc635d1f5c31e8296270eab66fd5bbc0afc6" + }, + "build": { + "firefly-builder": { + "image": "golang:1.16-alpine3.15" + }, + "fabric-builder": { + "image": "golang:1.16-alpine3.15", + "platform": "linux/x86_64" + }, + "solidity-builder": { + "image": "node:14-alpine3.15" + }, + "base": { + "image": "alpine:3.15" + } + }, + "ui": { + "tag": "v0.5.0", + "release": "v0.5.0_8cb358c" + }, + "cli": { + "tag": "v0.0.41" } } diff --git a/manifestgen.sh b/manifestgen.sh index 5f253f6199..32c6254186 100755 --- a/manifestgen.sh +++ b/manifestgen.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright © 2021 Kaleido, Inc. +# Copyright © 2022 Kaleido, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -31,6 +31,12 @@ if [[ $# -eq 1 ]] ; then fi fi +# These sections are currently not pulled from GitHub automatically +# so these sections are copied over from the existing file +BUILD_SECTION=$(cat manifest.json | jq .build) +UI_SECTION=$(cat manifest.json | jq .ui) +CLI_SECTION=$(cat manifest.json | jq .cli) + rm -f manifest.json SERVICES=( @@ -72,12 +78,12 @@ do echo " \"tag\": \"$TAG_LABEL\"," >> manifest.json echo " \"sha\": \"$SHA\"" >> manifest.json - if [[ $(($i + 1)) -eq ${SERVICE_COUNT} ]] - then - echo " }" >> manifest.json - else - echo " }," >> manifest.json - fi + echo " }," >> manifest.json done +# Add the build and UI sections, piping to sed to get proper indentation +echo "\"build\": $BUILD_SECTION," | sed 's/^/ /' >> manifest.json +echo "\"ui\": $UI_SECTION," | sed 's/^/ /' >> manifest.json +echo "\"cli\": $CLI_SECTION" | sed 's/^/ /' >> manifest.json + echo "}" >> manifest.json \ No newline at end of file diff --git a/smart_contracts/ethereum/solidity_firefly/package.json b/smart_contracts/ethereum/solidity_firefly/package.json index 853631d844..c1abf53ab4 100644 --- a/smart_contracts/ethereum/solidity_firefly/package.json +++ b/smart_contracts/ethereum/solidity_firefly/package.json @@ -2,6 +2,6 @@ "name": "@hyperledger/assettrail-contracts", "version": "0.0.1", "dependencies": { - "truffle": "^5.4.26" + "truffle": "^5.4.32" } } diff --git a/smart_contracts/ethereum/solidity_firefly/truffle-config.js b/smart_contracts/ethereum/solidity_firefly/truffle-config.js index e2ab3841b6..b388c81f32 100644 --- a/smart_contracts/ethereum/solidity_firefly/truffle-config.js +++ b/smart_contracts/ethereum/solidity_firefly/truffle-config.js @@ -11,7 +11,7 @@ module.exports = { }, compilers: { solc: { - version: "^0.7.0", // Fetch exact version from solc-bin (default: truffle's version) + version: "^0.8.0", // Fetch exact version from solc-bin (default: truffle's version) evmVersion: "constantinople" } } diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 321827ec79..ab2095c6f1 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -4,6 +4,7 @@ set -o pipefail CWD=$(dirname "$0") CLI="ff -v --ansi never" +CLI_VERSION=$(cat $CWD/../../manifest.json | jq -r .cli.tag) STACK_DIR=~/.firefly/stacks checkOk() { @@ -70,7 +71,7 @@ if [ "$BUILD_FIREFLY" == "true" ]; then fi if [ "$DOWNLOAD_CLI" == "true" ]; then - go install github.com/hyperledger/firefly-cli/ff@v0.0.41 + go install github.com/hyperledger/firefly-cli/ff@$CLI_VERSION checkOk $? fi From f337e5a6f1c2c7d089200dfbe30d6f2bf1db638d Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Mon, 7 Feb 2022 11:39:38 -0500 Subject: [PATCH 3/6] Fix docker build command in E2E script Signed-off-by: Nicko Guyer --- test/e2e/run.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/run.sh b/test/e2e/run.sh index ab2095c6f1..583a5515b2 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -66,8 +66,10 @@ if [ "$CREATE_STACK" == "true" ]; then fi if [ "$BUILD_FIREFLY" == "true" ]; then - docker build -t hyperledger/firefly ../.. + cd ../.. + make docker checkOk $? + cd $CWD fi if [ "$DOWNLOAD_CLI" == "true" ]; then From 981259ef0be7a4fbac6af23ff90014b56cb3fdba Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Mon, 7 Feb 2022 16:57:06 -0500 Subject: [PATCH 4/6] Update CLI syntax for token providers Signed-off-by: Nicko Guyer --- test/e2e/run.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 583a5515b2..25307f7f0e 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -66,10 +66,8 @@ if [ "$CREATE_STACK" == "true" ]; then fi if [ "$BUILD_FIREFLY" == "true" ]; then - cd ../.. - make docker + make -C ../.. docker checkOk $? - cd $CWD fi if [ "$DOWNLOAD_CLI" == "true" ]; then @@ -78,7 +76,7 @@ if [ "$DOWNLOAD_CLI" == "true" ]; then fi if [ "$CREATE_STACK" == "true" ]; then - $CLI init --prometheus-enabled --database $DATABASE_TYPE $STACK_NAME 2 --blockchain-provider $BLOCKCHAIN_PROVIDER --tokens-provider $TOKENS_PROVIDER --manifest ../../manifest.json + $CLI init --prometheus-enabled --database $DATABASE_TYPE $STACK_NAME 2 --blockchain-provider $BLOCKCHAIN_PROVIDER --token-providers $TOKENS_PROVIDER --manifest ../../manifest.json checkOk $? $CLI pull $STACK_NAME -r 3 From a50e3ce832e34ab7e13925df2397f203199ba75a Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Tue, 8 Feb 2022 08:38:42 -0500 Subject: [PATCH 5/6] Update manifest. Add check for jq. Signed-off-by: Nicko Guyer --- test/e2e/run.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 25307f7f0e..54ecf5d0bc 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -2,6 +2,8 @@ set -o pipefail + if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi + CWD=$(dirname "$0") CLI="ff -v --ansi never" CLI_VERSION=$(cat $CWD/../../manifest.json | jq -r .cli.tag) From 05eb88188de93e6a14c1ce6d9011c649e38d3e09 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Tue, 8 Feb 2022 08:50:01 -0500 Subject: [PATCH 6/6] Update manifest. Add check for jq. Signed-off-by: Nicko Guyer --- docker_build.sh | 4 ++-- manifest.json | 6 +++--- manifestgen.sh | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docker_build.sh b/docker_build.sh index e813e73a81..42e5de8c28 100755 --- a/docker_build.sh +++ b/docker_build.sh @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script will automatically update the manifest.json file with the -# latest releases of all FireFly microservice dependencies + + if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi FIREFLY_BUILDER_TAG=$(cat manifest.json | jq -r '.build."firefly-builder".image') FABRIC_BUILDER_TAG=$(cat manifest.json | jq -r '.build."fabric-builder".image') diff --git a/manifest.json b/manifest.json index eaa2fc51b8..7e493f394d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,8 @@ }, "fabconnect": { "image": "ghcr.io/hyperledger/firefly-fabconnect", - "tag": "v0.9.7", - "sha": "4b1bf26343ae90d6bdba12e1f3ae0eb95e31109b487233263ff0e5233dda5843" + "tag": "v0.9.8", + "sha": "e5d5775cfa6872ee55e9743072d5c8429ce6330312e863965855db7797860b56" }, "dataexchange-https": { "image": "ghcr.io/hyperledger/firefly-dataexchange-https", @@ -44,6 +44,6 @@ "release": "v0.5.0_8cb358c" }, "cli": { - "tag": "v0.0.41" + "tag": "v0.0.43" } } diff --git a/manifestgen.sh b/manifestgen.sh index 32c6254186..36d7db9c46 100755 --- a/manifestgen.sh +++ b/manifestgen.sh @@ -19,6 +19,8 @@ # This script will automatically update the manifest.json file with the # latest releases of all FireFly microservice dependencies + if [[ ! -x `which jq` ]]; then echo "Please install \"jq\" to continue"; exit 1; fi + USE_HEAD=false # If you pass the string "head" as an argument to this script, it will