diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17a65ea90..a14e25613 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,9 @@ Please visit the [contributors guide](http://hyperledger-fabric.readthedocs.io/e ## Folder Structure -This repo is structured as a monorepo using [Rush](https://rushjs.io/). Why a monorepo? There are multiple npm modules that are published from this repo, including end to end tests, and tooling. It is siginficant easier to manager within one repo - and Rush has proven to provide excellent support for management of issues such as different dependency versions. +This repo is structured as a monorepo using [Rush](https://rushjs.io/). Why a monorepo? There are multiple npm modules that are published from this repo, including end to end tests, and tooling. It is significantly easier to manager within one repo - and Rush has proven to provide excellent support for management of issues such as different dependency versions. -The standard Rush convetions are followed as much as possible, deviation only (currently) in publishing and broad release version control. This deviation is to fit in with the existing Hyperledger Fabric release process - and some of these features in Rush are still evolving. This current Rush configuration is also not meant to be the final configuration; we are happy to enterain changes to improve the structure +The standard Rush conventions are followed as much as possible, deviation only (currently) in publishing and broad release version control. This deviation is to fit in with the existing Hyperledger Fabric release process - and some of these features in Rush are still evolving. This current Rush configuration is also not meant to be the final configuration; we are happy to entertain changes to improve the structure ### Categories @@ -59,7 +59,7 @@ To clean up docker ## Mechanics of Contributing -The codebase is maintained in [github](https://github.com/hyperledger/fabric-chaincode-node), with a CI pileline run with [Azure Devlops](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build?definitionId=33&_a=summary). Issues are handling in [Jira](https://jira.hyperledger.org/issues/?jql=project%20%3D%20FAB%20AND%20component%20%3D%20fabric-chaincode-node) (please use the component `fabric-chaincode-node` in jira as this is shared project with other Fabric components). +The codebase is maintained in [github](https://github.com/hyperledger/fabric-chaincode-node), with a CI pipeline run with [Azure Devlops](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build?definitionId=33&_a=summary). Issues are handling in [Jira](https://jira.hyperledger.org/issues/?jql=project%20%3D%20FAB%20AND%20component%20%3D%20fabric-chaincode-node) (please use the component `fabric-chaincode-node` in jira as this is shared project with other Fabric components). diff --git a/apis/fabric-contract-api/package.json b/apis/fabric-contract-api/package.json index ca679f461..f4475a7dd 100644 --- a/apis/fabric-contract-api/package.json +++ b/apis/fabric-contract-api/package.json @@ -1,7 +1,7 @@ { "name": "fabric-contract-api", - "version": "2.0.0-snapshot", - "tag": "unstable", + "version": "2.0.0-beta.1", + "tag": "beta", "description": "A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other", "main": "index.js", "repository": { @@ -46,7 +46,7 @@ "lines": 100 }, "dependencies": { - "fabric-shim-api": "2.0.0-snapshot", + "fabric-shim-api": "2.0.0-beta.1", "class-transformer": "^0.2.2", "fast-safe-stringify": "~2.0.7", "get-params": "^0.1.2", diff --git a/apis/fabric-shim-api/package.json b/apis/fabric-shim-api/package.json index 6f4f52563..f642806cf 100644 --- a/apis/fabric-shim-api/package.json +++ b/apis/fabric-shim-api/package.json @@ -1,7 +1,7 @@ { "name": "fabric-shim-api", - "version": "2.0.0-snapshot", - "tag": "unstable", + "version": "2.0.0-beta.1", + "tag": "beta", "description": "A node.js API of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other", "main": "index.js", "repository": { diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index 37f402e76..1ac8aa797 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -58,8 +58,7 @@ stages: # output some basic information for reference - job: displayenv steps: - - script: | - env | sort + - template: templates/build-data.yaml - job: main displayName: 'Build, lint, UT' steps: @@ -222,15 +221,6 @@ stages: dependsOn: Build_and_Test condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags')) jobs: - - job: update_version - steps: - - script: | - env | sort - echo "Update the version number" - VERSION=$(jq '.version' $(Build.SourcesDirectory)/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/") - echo Version is :${VERSION}: - echo "Make sure release notes are present" - echo "Make sure change history is present" - job: npm_publish displayName: 'npm publish' steps: @@ -260,3 +250,29 @@ stages: set -ev echo "checkout docs branch" echo "checking" + - job: dockerhub_publish + steps: + - template: templates/build-data.yaml + - task: DownloadPipelineArtifact@2 + inputs: + artifact: nodeenv-docker-image + path: $(Build.SourcesDirectory)/build + + - script: | + wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64 + chmod +x ./manifest-tool + + docker image load --input build/fabric-nodeenv.tar.gz + docker images + # Publish docker images to nexus repository + docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD} + echo "Logged in to docker registry" + # tag nodeenv image to PACKAGE_VERSION + docker tag hyperledger/fabric-nodeenv fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)-beta + # push nodeenv to repository + docker push hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)-beta + ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)-beta" --target "hyperledger/fabric-nodeenv:$(BuildData.PACKAGE_VERSION)-beta" + ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)-beta" --target "hyperledger/fabric-nodeenv:2.0" + env: + DOCKER_REGISTRY_USERNAME: $(DockerHub-Username) + DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password) \ No newline at end of file diff --git a/ci/scripts/publish_docker.sh b/ci/scripts/publish_docker.sh index db5772bbc..5e5c2cb46 100755 --- a/ci/scripts/publish_docker.sh +++ b/ci/scripts/publish_docker.sh @@ -8,5 +8,5 @@ docker image load --input build/fabric-nodeenv.tar.gz # gets the build i docker images docker login nexus3.hyperledger.org:10003 --username="${NEXUS_USERNAME}" --password="${NEXUS_PASSWORD}" -docker tag hyperledger/fabric-nodeenv "${NEXUS_URL}/fabric-nodeenv:amd64-latest" -docker push "${NEXUS_URL}/fabric-nodeenv:amd64-latest" +docker tag hyperledger/fabric-nodeenv "${NEXUS_URL}/fabric-nodeenv:amd64-2.0.0-beta" +docker push "${NEXUS_URL}/fabric-nodeenv:amd64-2.0.0-beta" diff --git a/ci/templates/build-data.yaml b/ci/templates/build-data.yaml new file mode 100644 index 000000000..3cd792368 --- /dev/null +++ b/ci/templates/build-data.yaml @@ -0,0 +1,8 @@ +steps: +- script: | + env | sort + VERSION=$(jq '.version' $(Build.SourcesDirectory)/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/") + echo Current version in code is :${VERSION}: + echo "##vso[task.setvariable variable=PACKAGE_VERSION;isOutput=true]${VERSION}" + name: BuildData + displayName: 'Build data' \ No newline at end of file diff --git a/docs/apidocs/tutorials/using-chaincodeinterface.md b/docs/apidocs/tutorials/using-chaincodeinterface.md index 2289afcd5..2c049958c 100644 --- a/docs/apidocs/tutorials/using-chaincodeinterface.md +++ b/docs/apidocs/tutorials/using-chaincodeinterface.md @@ -8,7 +8,7 @@ cd mycc // create a new node project npm init // install fabric-shim at master branch -npm install fabric-shim@unstable +npm install 2.0.0-beta.1 // or using the released version npm install fabric-shim touch mychaincode.js @@ -68,7 +68,7 @@ Finally, update the "start" script in package.json to "node mychaincode.js": "engineStrict": true, "license": "Apache-2.0", "dependencies": { - "fabric-shim": "unstable" + "fabric-shim": "2.0.0-beta.1" } } ``` diff --git a/libraries/fabric-shim-crypto/package.json b/libraries/fabric-shim-crypto/package.json index 47d5b7310..6f932ac53 100644 --- a/libraries/fabric-shim-crypto/package.json +++ b/libraries/fabric-shim-crypto/package.json @@ -1,7 +1,7 @@ { "name": "fabric-shim-crypto", - "version": "2.0.0-snapshot", - "tag": "unstable", + "version": "2.0.0-beta.1", + "tag": "beta", "description": "A node.js implementation of encryption library for Hyperledger Fabric chaincode shim", "main": "index.js", "repository": { diff --git a/libraries/fabric-shim/package.json b/libraries/fabric-shim/package.json index 67ce8524c..4ff6cc4fe 100644 --- a/libraries/fabric-shim/package.json +++ b/libraries/fabric-shim/package.json @@ -1,7 +1,7 @@ { "name": "fabric-shim", - "version": "2.0.0-snapshot", - "tag": "unstable", + "version": "2.0.0-beta.1", + "tag": "beta", "description": "A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other", "main": "index.js", "bin": { @@ -61,8 +61,8 @@ "@grpc/proto-loader": "^0.5.1", "@types/node": "^8.9.4", "ajv": "^6.5.5", - "fabric-contract-api": "2.0.0-snapshot", - "fabric-shim-api": "2.0.0-snapshot", + "fabric-contract-api": "2.0.0-beta.1", + "fabric-shim-api": "2.0.0-beta.1", "fs-extra": "8.1.0", "grpc": "^1.23.3", "reflect-metadata": "^0.1.12", diff --git a/package.json b/package.json index c86b6a991..e912bc1ae 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fabric-shim-test", - "version": "2.0.0-snapshot", - "tag": "unstable", + "version": "2.0.0-beta.1", + "tag": "beta", "description": "fabric-shim, fabric-shim-crypto", "testFabricVersion": "master", "testFabricThirdParty": "0.4.15", diff --git a/release_notes/v2.0.0-beta.txt b/release_notes/v2.0.0-beta.txt new file mode 100644 index 000000000..3632ed89f --- /dev/null +++ b/release_notes/v2.0.0-beta.txt @@ -0,0 +1,53 @@ +v2.0.0-beta, 12 December 2019 +----------------------------- + +Release Notes +------------- +The main change in the v2.0.0 beta is the level of NodeJS runtime has moved up to the latest LTS version of v12.13.0 +v2.0.0 beta has the fixes from v1.4.4 level. + +Migration Notes +--------------- +Note that a change needed to be made to the metadata schema as it was in error; it had diverged from the JSONSchema standard +so that it was not possible to validate complex objects. + +If you have custom metadata defined in the contract, then for the complex objects defined in the 'components' section +the properties of this object where previously held as array; they now need to be held as a map with the key as the name +of the property + +Return types on functions where returned as an array of schema objects. this has been modified to be a single object. i.e. +the single value array is now just a single value. + +There is also a new nodeenv docker image that is used for hosting the chaincode rather than use the baseos image as in V1.4 + +In v1.4, the fabric-contract-api had a dependency on the fabric-shim. This has changed in this version to have a dependency +on the new fabric-shim-api module. This allows the fabric-contract-api to be used client side for annotations. + +For contributors, the v2.0.0 repo is built using rush and is organized as a full mono-repo. + +The @Object annotation has been deprecated in favour of the @DataType annotation + +The x509 library used for parsing has changed; this should be parse the X509 certificates exactly the same way; this is a note that +differences are observed in the parsed certificates please raise an issue. + +Summary of the programming model +------------------------------- + +This is designed to improve developer productivity and ease of use. +For more information see https://hyperledger-fabric.readthedocs.io/en/developapps/developing_applications.html + +Known Vulnerabilities +--------------------- +none + +Resolved Vulnerabilities +------------------------ +none + +Known Issues & Workarounds +-------------------------- +none + +Change Log +---------- +https://github.com/hyperledger/fabric-chaincode-node/blob/release-1.4/CHANGELOG.md#v141 diff --git a/test/chaincodes/annotations/package.json b/test/chaincodes/annotations/package.json index 651789446..81a529636 100644 --- a/test/chaincodes/annotations/package.json +++ b/test/chaincodes/annotations/package.json @@ -18,8 +18,8 @@ "author": "", "license": "APACHE-2.0", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable", + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1", "@types/node": "^10.3.6", "ts-node": "^3.3.0", "tslint": "^5.6.0", diff --git a/test/chaincodes/clientidentity/package.json b/test/chaincodes/clientidentity/package.json index 65616fd31..6d77e1b0c 100644 --- a/test/chaincodes/clientidentity/package.json +++ b/test/chaincodes/clientidentity/package.json @@ -15,7 +15,7 @@ "author": "", "license": "ISC", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/crosschaincode/package.json b/test/chaincodes/crosschaincode/package.json index 6b9c2cfb1..c367b27fb 100644 --- a/test/chaincodes/crosschaincode/package.json +++ b/test/chaincodes/crosschaincode/package.json @@ -15,7 +15,7 @@ "author": "", "license": "ISC", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/crosschaincode2/package.json b/test/chaincodes/crosschaincode2/package.json index 6b9c2cfb1..c367b27fb 100644 --- a/test/chaincodes/crosschaincode2/package.json +++ b/test/chaincodes/crosschaincode2/package.json @@ -15,7 +15,7 @@ "author": "", "license": "ISC", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/crud/package.json b/test/chaincodes/crud/package.json index 65416ceee..6e797f9ed 100644 --- a/test/chaincodes/crud/package.json +++ b/test/chaincodes/crud/package.json @@ -15,7 +15,7 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/encryption/package.json b/test/chaincodes/encryption/package.json index 7da5dd8b7..61e31fcec 100644 --- a/test/chaincodes/encryption/package.json +++ b/test/chaincodes/encryption/package.json @@ -15,8 +15,8 @@ "author": "", "license": "ISC", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable", - "fabric-shim-crypto": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1", + "fabric-shim-crypto": "2.0.0-beta.1" } } diff --git a/test/chaincodes/events/package.json b/test/chaincodes/events/package.json index 97f4805fd..a3a7af6a1 100644 --- a/test/chaincodes/events/package.json +++ b/test/chaincodes/events/package.json @@ -15,7 +15,7 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/query/package.json b/test/chaincodes/query/package.json index bbea416a5..e0226fbcc 100644 --- a/test/chaincodes/query/package.json +++ b/test/chaincodes/query/package.json @@ -15,7 +15,7 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/chaincodes/scenario/package.json b/test/chaincodes/scenario/package.json index 9fea03abe..5cdfc4efc 100644 --- a/test/chaincodes/scenario/package.json +++ b/test/chaincodes/scenario/package.json @@ -15,7 +15,7 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "fabric-shim": "unstable", - "fabric-contract-api": "unstable" + "fabric-shim": "2.0.0-beta.1", + "fabric-contract-api": "2.0.0-beta.1" } } diff --git a/test/fv/package.json b/test/fv/package.json index f1cf1a64a..8b5fafcc6 100644 --- a/test/fv/package.json +++ b/test/fv/package.json @@ -1,6 +1,6 @@ { "name": "fvtests", - "version": "2.0.0-snapshot", + "version": "2.0.0-beta.1", "description": "fv tests", "testFabricVersion": "master", "testFabricThirdParty": "0.4.15", @@ -26,10 +26,10 @@ "del": "^3.0.0", "delay": "4.3.0", "eslint": "6.6.0", - "fabric-contract-api": "2.0.0-snapshot", - "fabric-shim": "2.0.0-snapshot", - "fabric-shim-api": "2.0.0-snapshot", - "fabric-shim-crypto": "2.0.0-snapshot", + "fabric-contract-api": "2.0.0-beta.1", + "fabric-shim": "2.0.0-beta.1", + "fabric-shim-api": "2.0.0-beta.1", + "fabric-shim-crypto": "2.0.0-beta.1", "fs-extra": "8.1.0", "git-rev-sync": "1.12.0", "gulp": "^4.0.0", diff --git a/tools/scripts/release.sh b/tools/scripts/release.sh index e38d0a7a4..c33274702 100755 --- a/tools/scripts/release.sh +++ b/tools/scripts/release.sh @@ -46,7 +46,7 @@ elif [[ ${NEW_SUFFIX} == 'snapshot' ]]; then echo new suffix is ${NEW_SUFFIX} CURRENT_VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9])(.)*/\1/") NEW_VERSION=$( ${DIR}/node_modules/.bin/semver -i ${CURRENT_VERSION} )-snapshot - NEW_TAG="unstable-1.4" + NEW_TAG="2.0.0-beta.1-1.4" else # for beta, rc etc releases where the version doesn't change echo new suffix is ${NEW_SUFFIX} NEW_VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9])(.)*/\1-${NEW_SUFFIX}/") diff --git a/tools/toolchain/network/docker-compose/docker-compose-base.yaml b/tools/toolchain/network/docker-compose/docker-compose-base.yaml index 0ca3857dd..435ce9d77 100644 --- a/tools/toolchain/network/docker-compose/docker-compose-base.yaml +++ b/tools/toolchain/network/docker-compose/docker-compose-base.yaml @@ -92,7 +92,7 @@ services: # # bridge network as the peers # # https://docs.docker.com/compose/networking/ - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=node_default - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:2.0.0-snapshot + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:2.0.0-beta.1 # Allow more time for chaincode container to build on install. - CORE_CHAINCODE_EXECUTETIMEOUT=300s working_dir: /opt/gopath/src/github.com/hyperledger/fabric