diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000000..0f059509d9 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,395 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/Azure/go-ansiterm" + packages = [".","winterm"] + revision = "19f72df4d05d31cbe1c56bfc8045c96babff6c7e" + +[[projects]] + name = "github.com/Knetic/govaluate" + packages = ["."] + revision = "d216395917cc49052c7c7094cf57f09657ca08a8" + version = "v3.0.0" + +[[projects]] + name = "github.com/Microsoft/go-winio" + packages = ["."] + revision = "78439966b38d69bf38227fbf57ac8a6fee70f69a" + version = "v0.4.5" + +[[projects]] + branch = "master" + name = "github.com/Nvveen/Gotty" + packages = ["."] + revision = "cd527374f1e5bff4938207604a14f2e38a9cf512" + +[[projects]] + branch = "master" + name = "github.com/beorn7/perks" + packages = ["quantile"] + revision = "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9" + +[[projects]] + branch = "master" + name = "github.com/cloudflare/cfssl" + packages = ["api","api/client","auth","certdb","certdb/sql","cli","config","crypto/pkcs7","csr","errors","helpers","helpers/derhelpers","info","initca","log","ocsp","ocsp/config","revoke","signer","signer/local","signer/remote","signer/universal"] + revision = "fb16c3479c6ecbd2211751586b206f71387349e6" + +[[projects]] + name = "github.com/coreos/etcd" + packages = ["raft/raftpb"] + revision = "9d43462d174c664f5edf313dec0de31e1ef4ed47" + version = "v3.2.6" + +[[projects]] + branch = "master" + name = "github.com/docker/docker" + packages = ["api/types","api/types/blkiodev","api/types/container","api/types/filters","api/types/mount","api/types/network","api/types/registry","api/types/strslice","api/types/swarm","api/types/swarm/runtime","api/types/versions","daemon/cluster/convert","opts","pkg/archive","pkg/fileutils","pkg/homedir","pkg/idtools","pkg/ioutils","pkg/jsonlog","pkg/jsonmessage","pkg/longpath","pkg/mount","pkg/namesgenerator","pkg/pools","pkg/promise","pkg/stdcopy","pkg/system","pkg/term","pkg/term/windows"] + revision = "ff6fbe224f8b490b05f8489e5ae3219126d8017b" + source = "github.com/moby/moby" + +[[projects]] + branch = "master" + name = "github.com/docker/go-connections" + packages = ["nat"] + revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d" + +[[projects]] + branch = "master" + name = "github.com/docker/go-events" + packages = ["."] + revision = "9461782956ad83b30282bf90e31fa6a70c255ba9" + +[[projects]] + branch = "master" + name = "github.com/docker/go-units" + packages = ["."] + revision = "0dadbb0345b35ec7ef35e228dabb8de89a65bf52" + +[[projects]] + branch = "master" + name = "github.com/docker/libkv" + packages = [".","store"] + revision = "93ab0e6c056d325dfbb11e1d58a3b4f5f62e7f3c" + +[[projects]] + branch = "master" + name = "github.com/docker/libnetwork" + packages = ["datastore","discoverapi","types"] + revision = "a104b31ea07b43ec3b60f3077a119c0b6f913a0a" + +[[projects]] + branch = "master" + name = "github.com/docker/swarmkit" + packages = ["api","api/deepcopy","api/equality","api/genericresource","api/naming","ca","connectionbroker","identity","ioutils","log","manager/raftselector","manager/state","manager/state/store","protobuf/plugin","remotes","watch","watch/queue"] + revision = "0554c9bc9a485025e89b8e5c2c1f0d75961906a2" + +[[projects]] + name = "github.com/fsnotify/fsnotify" + packages = ["."] + revision = "629574ca2a5df945712d3079857300b5e4da0236" + version = "v1.4.2" + +[[projects]] + branch = "master" + name = "github.com/fsouza/go-dockerclient" + packages = ["."] + revision = "75772940379e725b5aae213e570f9dcd751951cb" + +[[projects]] + name = "github.com/go-sql-driver/mysql" + packages = ["."] + revision = "a0583e0143b1624142adab07e0e97fe106d99561" + version = "v1.3" + +[[projects]] + name = "github.com/gogo/protobuf" + packages = ["gogoproto","proto","protoc-gen-gogo/descriptor","sortkeys","types"] + revision = "100ba4e885062801d56799d78530b73b178a78f3" + version = "v0.4" + +[[projects]] + name = "github.com/golang/mock" + packages = ["gomock"] + revision = "13f360950a79f5864a972c786a10a50e44b69541" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "github.com/golang/protobuf" + packages = ["proto","ptypes/any","ptypes/empty","ptypes/timestamp"] + revision = "ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e" + +[[projects]] + branch = "master" + name = "github.com/google/certificate-transparency-go" + packages = [".","asn1","client","jsonclient","tls","x509","x509/pkix"] + revision = "d1967574b72e51f90f961cc40e5221d75986f0c7" + +[[projects]] + name = "github.com/grpc-ecosystem/go-grpc-prometheus" + packages = ["."] + revision = "6b7015e65d366bf3f19b2b2a000a831940f0f7e0" + version = "v1.1" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-immutable-radix" + packages = ["."] + revision = "8aac2701530899b64bdea735a1de8da899815220" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/go-memdb" + packages = ["."] + revision = "2b2d6c35e14e7557ea1003e707d5e179fa315028" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/golang-lru" + packages = ["simplelru"] + revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6" + +[[projects]] + branch = "master" + name = "github.com/hashicorp/hcl" + packages = [".","hcl/ast","hcl/parser","hcl/scanner","hcl/strconv","hcl/token","json/parser","json/scanner","json/token"] + revision = "392dba7d905ed5d04a5794ba89f558b27e2ba1ca" + +[[projects]] + name = "github.com/hyperledger/fabric" + packages = ["bccsp","bccsp/factory","bccsp/pkcs11","bccsp/signer","bccsp/sw","bccsp/utils","common/cauthdsl","common/config","common/config/msp","common/crypto","common/errors","common/flogging","common/ledger","common/ledger/util","common/metadata","common/policies","common/util","core/chaincode/platforms","core/chaincode/platforms/car","core/chaincode/platforms/golang","core/chaincode/platforms/java","core/chaincode/platforms/util","core/chaincode/shim","core/comm","core/config","core/container/util","core/ledger/kvledger/txmgmt/rwsetutil","core/ledger/kvledger/txmgmt/version","core/ledger/util","events/consumer","msp","msp/mgmt","protos/common","protos/ledger/queryresult","protos/ledger/rwset","protos/ledger/rwset/kvrwset","protos/msp","protos/orderer","protos/peer","protos/utils"] + revision = "e43b68fa22123cd0e80788fd46977b7534a51688" + version = "v1.0.1" + +[[projects]] + name = "github.com/hyperledger/fabric-ca" + packages = ["api","lib","lib/dbutil","lib/ldap","lib/spi","lib/tcert","lib/tls","util"] + revision = "0262ccbeeb09a8ec85e47a7c051e9b7ddd6856b8" + version = "v1.0.1" + +[[projects]] + name = "github.com/jmhodges/clock" + packages = ["."] + revision = "880ee4c335489bc78d01e4d0a254ae880734bc15" + version = "v1.1" + +[[projects]] + branch = "master" + name = "github.com/jmoiron/sqlx" + packages = [".","reflectx"] + revision = "d9bd385d68c068f1fabb5057e3dedcbcbb039d0f" + +[[projects]] + branch = "master" + name = "github.com/kisielk/sqlstruct" + packages = ["."] + revision = "648daed35d49dac24a4bff253b190a80da3ab6a5" + +[[projects]] + branch = "master" + name = "github.com/lib/pq" + packages = [".","oid"] + revision = "e42267488fe361b9dc034be7a6bffef5b195bceb" + +[[projects]] + branch = "master" + name = "github.com/looplab/fsm" + packages = ["."] + revision = "bcc3636384ce80a109a6039432b30ff5b82476ee" + +[[projects]] + name = "github.com/magiconair/properties" + packages = ["."] + revision = "be5ece7dd465ab0765a9682137865547526d1dfb" + version = "v1.7.3" + +[[projects]] + name = "github.com/mattn/go-sqlite3" + packages = ["."] + revision = "ca5e3819723d8eeaf170ad510e7da1d6d2e94a08" + version = "v1.2.0" + +[[projects]] + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + revision = "3247c84500bff8d9fb6d579d800f20b3e091582c" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "github.com/miekg/pkcs11" + packages = ["."] + revision = "7283ca79f35edb89bc1b4ecae7f86a3680ce737f" + +[[projects]] + branch = "master" + name = "github.com/mitchellh/mapstructure" + packages = ["."] + revision = "d0303fe809921458f417bcf828397a65db30a7e4" + +[[projects]] + branch = "datarace" + name = "github.com/op/go-logging" + packages = ["."] + revision = "1df6e860446321cc5ab45e62e1def171321c92fb" + source = "github.com/troyronda/go-logging" + +[[projects]] + name = "github.com/opencontainers/go-digest" + packages = ["."] + revision = "aa2ec055abd10d26d539eb630a92241b781ce4bc" + version = "v1.0.0-rc0" + +[[projects]] + name = "github.com/opencontainers/image-spec" + packages = ["specs-go","specs-go/v1"] + revision = "ab7389ef9f50030c9b245bc16b981c7ddf192882" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "github.com/opencontainers/runc" + packages = ["libcontainer/system","libcontainer/user"] + revision = "ae2948042b08ad3d6d13cd09f40a50ffff4fc688" + +[[projects]] + name = "github.com/pelletier/go-buffruneio" + packages = ["."] + revision = "c37440a7cf42ac63b919c752ca73a85067e05992" + version = "v0.2.0" + +[[projects]] + name = "github.com/pelletier/go-toml" + packages = ["."] + revision = "5ccdfb18c776b740aecaf085c4d9a2779199c279" + version = "v1.0.0" + +[[projects]] + name = "github.com/pkg/errors" + packages = ["."] + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + +[[projects]] + name = "github.com/prometheus/client_golang" + packages = ["prometheus"] + revision = "c5b7fccd204277076155f10851dad72b76a49317" + version = "v0.8.0" + +[[projects]] + branch = "master" + name = "github.com/prometheus/client_model" + packages = ["go"] + revision = "6f3806018612930941127f2a7c6c453ba2c527d2" + +[[projects]] + branch = "master" + name = "github.com/prometheus/common" + packages = ["expfmt","internal/bitbucket.org/ww/goautoneg","model"] + revision = "61f87aac8082fa8c3c5655c7608d7478d46ac2ad" + +[[projects]] + branch = "master" + name = "github.com/prometheus/procfs" + packages = [".","xfs"] + revision = "e645f4e5aaa8506fc71d6edbc5c4ff02c04c46f2" + +[[projects]] + name = "github.com/sirupsen/logrus" + packages = ["."] + revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e" + version = "v1.0.3" + +[[projects]] + branch = "master" + name = "github.com/spf13/afero" + packages = [".","mem"] + revision = "9be650865eab0c12963d8753212f4f9c66cdcf12" + +[[projects]] + name = "github.com/spf13/cast" + packages = ["."] + revision = "acbeb36b902d72a7a4c18e8f3241075e7ab763e4" + version = "v1.1.0" + +[[projects]] + branch = "master" + name = "github.com/spf13/jwalterweatherman" + packages = ["."] + revision = "0efa5202c04663c757d84f90f5219c1250baf94f" + +[[projects]] + name = "github.com/spf13/pflag" + packages = ["."] + revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66" + version = "v1.0.0" + +[[projects]] + name = "github.com/spf13/viper" + packages = ["."] + revision = "25b30aa063fc18e48662b86996252eabdcf2f0c7" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = ["bcrypt","blowfish","ocsp","pkcs12","pkcs12/internal/rc2","sha3","ssh/terminal"] + revision = "eb71ad9bd329b5ac0fd0148dd99bd62e8be8e035" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["context","context/ctxhttp","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"] + revision = "57efc9c3d9f91fb3277f8da1cff370539c4d3dc5" + +[[projects]] + branch = "master" + name = "golang.org/x/sys" + packages = ["unix","windows"] + revision = "07c182904dbd53199946ba614a412c61d3c548f5" + +[[projects]] + branch = "master" + name = "golang.org/x/text" + packages = ["internal/gen","internal/triegen","internal/ucd","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] + revision = "cc24f0397b10b6321b1a1322b6bd592984fdabf2" + +[[projects]] + branch = "master" + name = "google.golang.org/genproto" + packages = ["googleapis/rpc/status"] + revision = "ee236bd376b077c7a89f260c026c4735b195e459" + +[[projects]] + name = "google.golang.org/grpc" + packages = [".","codes","connectivity","credentials","grpclb/grpc_lb_v1","grpclog","internal","keepalive","metadata","naming","peer","stats","status","tap","transport"] + revision = "b3ddf786825de56a4178401b7e174ee332173b66" + version = "v1.5.2" + +[[projects]] + name = "gopkg.in/asn1-ber.v1" + packages = ["."] + revision = "379148ca0225df7a432012b8df0355c2a2063ac0" + version = "v1.2" + +[[projects]] + name = "gopkg.in/ldap.v2" + packages = ["."] + revision = "8168ee085ee43257585e50c6441aadf54ecb2c9f" + version = "v2.5.0" + +[[projects]] + branch = "v2" + name = "gopkg.in/yaml.v2" + packages = ["."] + revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "e141c566afd19ee0e18f44554921f829f787f8affc22f3cef7d3597c045c082c" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000000..e3b5226ea8 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,77 @@ +# +# Copyright SecureKey Technologies Inc. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +[[constraint]] + name = "github.com/hyperledger/fabric" + version = "~1.0.0" + +[[constraint]] + name = "github.com/hyperledger/fabric-ca" + version = "~1.0.0" + +[[constraint]] + name = "github.com/golang/mock" + version = "^1.0.0" + +[[constraint]] + name = "github.com/spf13/viper" + version = "^1.0.0" + +[[constraint]] + name = "google.golang.org/grpc" + version = "^1.0.0" + +[[constraint]] + name = "github.com/golang/protobuf" + branch = "master" + +[[constraint]] + name = "golang.org/x/net" + branch = "master" + +################ +# Downstream overrides to enable testing +# (https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version) + +# Mainly downstreams that have a direct reference +[[override]] + name = "github.com/op/go-logging" + # TODO: source isn't picked up by parent projects - need better solution + source = "github.com/troyronda/go-logging" # TODO: Better home for this fork + branch = "datarace" + # note: go-logging is mainly a downstream package but is also in tests to ensure the fork is applied + +[[override]] + name = "github.com/cloudflare/cfssl" + branch = "master" + # note: cfssl is mainly a downstream package but is also used in the SDK mocks + +# Downstream overrides due to inconsistent semver +[[override]] +name = "github.com/docker/libnetwork" +branch = "master" + +[[override]] +name = "github.com/docker/go-connections" +branch = "master" + +[[override]] +name = "github.com/docker/go-units" +branch = "master" + +[[override]] +name = "github.com/docker/libkv" +branch = "master" + +# Temporary downstream overrides due to sirupsen/logrus case sensitivity +[[override]] +name = "github.com/docker/docker" +source = "github.com/moby/moby" +branch = "master" + +[[override]] +name = "github.com/opencontainers/runc" +branch = "master" diff --git a/Makefile b/Makefile index 79c76f958f..8acd8cc1d7 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,15 @@ # Supported Targets: # all : runs unit and integration tests -# depend: installs test dependencies +# depend: checks that test dependencies are installed +# depend-install: installs test dependencies # unit-test: runs all the unit tests # integration-test: runs all the integration tests # checks: runs all check conditions (license, spelling, linting) # clean: stops docker conatainers used for integration testing # mock-gen: generate mocks needed for testing (using mockgen) +# populate: populates generated files (not included in git) - currently only vendor +# populate-vendor: populate the vendor directory based on the lock # # # Instructions to generate .tx files used for creating channels: @@ -26,13 +29,21 @@ export ARCH=$(shell uname -m) export LDFLAGS=-ldflags=-s export DOCKER_NS=hyperledger export DOCKER_TAG=$(ARCH)-0.3.1 +export GO_DEP_COMMIT=v0.3.0 # the version of dep that will be installed by depend-install (or in the CI) +# Detect CI +ifdef JENKINS_URL +export FABRIC_SDKGO_DEPEND_INSTALL=true +endif all: checks unit-test integration-test depend: @test/scripts/dependencies.sh +depend-install: + @FABRIC_SDKGO_DEPEND_INSTALL="true" test/scripts/dependencies.sh + checks: depend license lint spelling .PHONY: license build-softhsm2-image @@ -58,28 +69,33 @@ restore-docker-file: && sed -i.bak -e 's/$(DOCKER_TAG)/_TAG_/g' Dockerfile\ && rm -rf Dockerfile.bak -unit-test: clean edit-docker build-softhsm2-image restore-docker-file +unit-test: clean depend populate edit-docker build-softhsm2-image restore-docker-file @cd ./test/fixtures && docker-compose -f docker-compose-unit.yaml up --abort-on-container-exit @test/scripts/check_status.sh "./test/fixtures/docker-compose-unit.yaml" unit-tests: unit-test -integration-test: clean depend edit-docker build-softhsm2-image restore-docker-file +integration-test: clean depend populate edit-docker build-softhsm2-image restore-docker-file @cd ./test/fixtures && docker-compose up --force-recreate --abort-on-container-exit @test/scripts/check_status.sh "./test/fixtures/docker-compose.yaml" integration-tests: integration-test mock-gen: - go get -u github.com/golang/mock/gomock - go get -u github.com/golang/mock/mockgen mockgen -build_flags '$(LDFLAGS)' github.com/hyperledger/fabric-sdk-go/api/apitxn ProposalProcessor | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" > api/apitxn/mocks/mockapitxn.gen.go mockgen -build_flags '$(LDFLAGS)' github.com/hyperledger/fabric-sdk-go/api/apiconfig Config | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" > api/apiconfig/mocks/mockconfig.gen.go mockgen -build_flags '$(LDFLAGS)' github.com/hyperledger/fabric-sdk-go/api/apifabca FabricCAClient | sed "s/github.com\/hyperledger\/fabric-sdk-go\/vendor\///g" > api/apifabca/mocks/mockfabriccaclient.gen.go +populate: populate-vendor + +populate-vendor: + @echo "Populating vendor ..." + @dep ensure -vendor-only + clean: rm -Rf /tmp/enroll_user /tmp/msp /tmp/keyvaluestore rm -f integration-report.xml report.xml cd test/fixtures && docker-compose down cd test/fixtures && docker-compose -f docker-compose-unit.yaml down + rm -Rf vendor \ No newline at end of file diff --git a/README.md b/README.md index 016d3cbf33..b13ee70c0a 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ repository. ### Compatibility This client SDK was last tested and found to be compatible with the following Hyperledger Fabric commit levels: -- fabric: v1.0.0 -- fabric-ca: v1.0.0 +- fabric: v1.0.1 +- fabric-ca: v1.0.1 ### Running the test suite @@ -47,6 +47,9 @@ This client SDK was last tested and found to be compatible with the following Hy # In the Fabric SDK Go directory cd $GOPATH/src/github.com/hyperledger/fabric-sdk-go/ +# Optional - Automatically install Go tools used by test suite +# make depend-install + # Running test suite make @@ -60,6 +63,7 @@ If you want to contribute to the Go SDK, please run the test suite and submit pa You need: - Go +- [Dep](https://github.com/golang/dep) - Make - Docker - Docker Compose diff --git a/test/scripts/check_license.sh b/test/scripts/check_license.sh index 1b66a448df..ce9e2178af 100755 --- a/test/scripts/check_license.sh +++ b/test/scripts/check_license.sh @@ -1,25 +1,28 @@ #!/bin/bash # -# Copyright IBM Corp. All Rights Reserved. +# Copyright IBM Corp, SecureKey Technologies Inc. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # -CHECK=$(git diff --name-only HEAD --diff-filter=ACMRTUXB * | grep -v .png$ | grep -v .rst$ | grep -v ^.git$ \ +function filterExcludedFiles { + CHECK=`echo "$CHECK" | grep -v .png$ | grep -v .rst$ | grep -v ^.git/ \ | grep -v .pem$ | grep -v .block$ | grep -v .tx$ | grep -v ^LICENSE$ | grep -v _sk$ \ - | grep -v .key$ | grep -v \\.gen.go$ \ - | grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | sort -u) + | grep -v .key$ | grep -v \\.gen.go$ | grep -v ^Gopkg.lock$ \ + | grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | sort -u` +} + +CHECK=$(git diff --name-only HEAD --diff-filter=ACMRTUXB *) +filterExcludedFiles if [[ -z "$CHECK" ]]; then CHECK=$(git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -r $(git log -2 \ - --pretty=format:"%h") | grep -v .png$ | grep -v .rst$ | grep -v ^.git$ \ - | grep -v .pem$ | grep -v .block$ | grep -v .tx$ | grep -v ^LICENSE$ | grep -v _sk$ \ - | grep -v .key$ | grep -v \\.gen.go$ \ - | grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | sort -u) + --pretty=format:"%h")) + filterExcludedFiles fi echo "Checking committed files for SPDX-License-Identifier headers ..." -missing=`echo "$CHECK" | xargs grep -L "SPDX-License-Identifier"` +missing=`echo "$CHECK" | xargs ls -d 2>/dev/null | xargs grep -L "SPDX-License-Identifier"` if [[ -z "$missing" ]]; then echo "All files have SPDX-License-Identifier headers" exit 0 diff --git a/test/scripts/dependencies.sh b/test/scripts/dependencies.sh index 8a0b63a5cf..d8c9865fc1 100755 --- a/test/scripts/dependencies.sh +++ b/test/scripts/dependencies.sh @@ -6,16 +6,44 @@ # # This script installs dependencies for testing tools # Environment variables that affect this script: -# FABRIC_SDKGO_SKIP_DEPEND: Skips installation of dependencies. +# FABRIC_SDKGO_DEPEND_INSTALL: Installs dependencies +# GO_DEP_COMMIT: Tag or commit level of the go dep tool to install (if FABRIC_SDKGO_DEPEND_INSTALL=true) - -if [ -z "$FABRIC_SDKGO_SKIP_DEPEND" ]; then - echo "Installing dependencies..." +# Automatically install go tools (particularly for CI) +if [ "$FABRIC_SDKGO_DEPEND_INSTALL" = "true" ]; then + echo "Installing dependencies ..." go get -u github.com/axw/gocov/... go get -u github.com/AlekSi/gocov-xml go get -u github.com/client9/misspell/cmd/misspell go get -u github.com/golang/lint/golint go get -u golang.org/x/tools/cmd/goimports -else - echo "Skipping install dependencies..." + go get -u github.com/golang/mock/mockgen +fi + +# Install specific version of go dep (particularly for CI) +if [ "$FABRIC_SDKGO_DEPEND_INSTALL" = "true" ] && [ -n "$GO_DEP_COMMIT" ]; then + echo "Installing dep@$GO_DEP_COMMIT to $GOPATH/bin ..." + TMP=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` + + GOPATH=$TMP go get -d github.com/golang/dep + cd $TMP/src/github.com/golang/dep + git reset --hard $GO_DEP_COMMIT + GOPATH=$TMP go install github.com/golang/dep/cmd/dep + cp $TMP/bin/dep $GOPATH/bin + + rm -Rf $TMP +fi + +# Check that Go tools are installed and help the user if they are missing +type gocov >/dev/null 2>&1 || { echo >& 2 "gocov is not installed (go get -u github.com/axw/gocov/...)"; ABORT=1; } +type gocov-xml >/dev/null 2>&1 || { echo >& 2 "gocov-xml is not installed (go get -u github.com/AlekSi/gocov-xml)"; ABORT=1; } +type misspell >/dev/null 2>&1 || { echo >& 2 "misspell is not installed (go get -u github.com/client9/misspell/cmd/misspell)"; ABORT=1; } +type golint >/dev/null 2>&1 || { echo >& 2 "golint is not installed (go get -u github.com/golang/lint/golint)"; ABORT=1; } +type goimports >/dev/null 2>&1 || { echo >& 2 "goimports is not installed (go get -u golang.org/x/tools/cmd/goimports)"; ABORT=1; } +type mockgen >/dev/null 2>&1 || { echo >& 2 "mockgen is not installed (go get -u github.com/golang/mock/mockgen)"; ABORT=1; } +type dep >/dev/null 2>&1 || { echo >& 2 "dep is not installed (go get -u github.com/golang/dep/cmd/dep)"; ABORT=1; } + +if [ -n "$ABORT" ]; then + echo "Missing dependency. Aborting. You can fix by installing the tool listed above or running make depend-install." + exit 1 fi diff --git a/test/scripts/fabric_test_commitlevel.sh b/test/scripts/fabric_test_commitlevel.sh index 9202bdaaa3..97b1f4abf1 100755 --- a/test/scripts/fabric_test_commitlevel.sh +++ b/test/scripts/fabric_test_commitlevel.sh @@ -11,5 +11,5 @@ export USE_PREBUILT_IMAGES=true #file used for automatic integration build test #This should always match the compatibility specified in the README.md -export FABRIC_COMMIT=v1.0.0 -export FABRIC_CA_COMMIT=v1.0.0 +export FABRIC_COMMIT=v1.0.1 +export FABRIC_CA_COMMIT=v1.0.1