diff --git a/Makefile b/Makefile index e34c7f7704..7ed569f06d 100644 --- a/Makefile +++ b/Makefile @@ -63,8 +63,7 @@ FABRIC_DEV_REGISTRY ?= nexus3.hyperledger.org:10001 FABRIC_DEV_REGISTRY_PRE_CMD ?= docker login -u docker -p docker nexus3.hyperledger.org:10001 # Base image variables for socat and softshm builds -BASE_UBUNTU_VERSION = "xenial" -BASE_GO_VERSION = "1.12.5" +BASE_GO_VERSION = "1.13" # Upstream fabric patching (overridable) THIRDPARTY_FABRIC_CA_BRANCH ?= master @@ -277,16 +276,9 @@ lint-all: version populate-noforce .PHONY: build-softhsm2-image build-softhsm2-image: @$(DOCKER_CMD) build --no-cache -q -t "fabsdkgo-softhsm2" \ - --build-arg BASE_UBUNTU_VERSION=$(BASE_UBUNTU_VERSION) \ --build-arg BASE_GO_VERSION=$(BASE_GO_VERSION) \ -f $(FIXTURE_SOFTHSM2_PATH)/Dockerfile . -.PHONY: build-socat-image -build-socat-image: - @$(DOCKER_CMD) build --no-cache -q -t "fabsdkgo-socat" \ - --build-arg BASE_UBUNTU_VERSION=$(BASE_UBUNTU_VERSION) \ - -f $(FIXTURE_SOCAT_PATH)/Dockerfile . - .PHONY: unit-test unit-test: clean-tests depend-noforce populate-noforce license lint-submodules @TEST_CHANGED_ONLY=$(FABRIC_SDKGO_TEST_CHANGED) TEST_WITH_LINTER=true FABRIC_SDKGO_CODELEVEL_TAG=$(FABRIC_CODELEVEL_UNITTEST_TAG) FABRIC_SDKGO_CODELEVEL_VER=$(FABRIC_CODELEVEL_UNITTEST_VER) \ diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml new file mode 100644 index 0000000000..ec0f1945ca --- /dev/null +++ b/ci/azure-pipelines.yml @@ -0,0 +1,42 @@ +# Copyright the Hyperledger Fabric contributors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr) +trigger: +- master +pr: +- master + +variables: + GOPATH: $(Agent.BuildDirectory)/go + PATH: $(Agent.BuildDirectory)/go/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin + GOVER: 1.13 + +jobs: +- job: UnitTest + pool: + vmImage: ubuntu-16.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install_deps.yml + - checkout: self + # TODO: seperate unit-test and checks. + # TODO: resolve dependencies between dependencies.sh and install_deps.yml + - script: make unit-test + displayName: Run checks and unit test + +- job: IntegrationTest + pool: + vmImage: ubuntu-16.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install_deps.yml + - checkout: self + - script: make integration-test + displayName: Run integration test + env: + # TODO: update this variable name in the Makefile + JENKINS_URL: true \ No newline at end of file diff --git a/ci/install_deps.yml b/ci/install_deps.yml new file mode 100644 index 0000000000..4fa68f5083 --- /dev/null +++ b/ci/install_deps.yml @@ -0,0 +1,18 @@ +# Copyright the Hyperledger Fabric contributors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +steps: + - script: sudo apt-get clean + displayName: Run apt clean + - script: sudo apt-get update + displayName: Run apt update + - script: sudo apt-get install -y gcc haveged libtool make + displayName: Install dependencies + - task: GoTool@0 + inputs: + version: $(GOVER) + goPath: $(GOPATH) + displayName: Install Go $(GOVER) + - script: GO111MODULE=off go get -u github.com/myitcv/gobin + displayName: Install gobin \ No newline at end of file diff --git a/golangci.yml b/golangci.yml index 67c81a4ae3..4f0bb492ba 100755 --- a/golangci.yml +++ b/golangci.yml @@ -6,7 +6,7 @@ run: concurrency: 4 - deadline: 1m + deadline: 5m issues-exit-code: 1 tests: true build-tags: [] diff --git a/test/fixtures/dockerenv/docker-compose-chaincoded.yaml b/test/fixtures/dockerenv/docker-compose-chaincoded.yaml index 067a39672d..3792bbf84d 100644 --- a/test/fixtures/dockerenv/docker-compose-chaincoded.yaml +++ b/test/fixtures/dockerenv/docker-compose-chaincoded.yaml @@ -23,7 +23,8 @@ services: # - dockerd.example.com chaincoded: - image: ${FABRIC_BASE_DOCKER_REGISTRY}${FABRIC_BASEIMAGE_FIXTURE_IMAGE}:${FABRIC_ARCH}${FABRIC_ARCH_SEP}${FABRIC_BASEIMAGE_FIXTURE_TAG} + # TODO: parameterize golang version + image: golang:1.13 environment: - DOCKER_HOST=http://dockerd.example.com:2375 - CHAINCODED_VERBOSE diff --git a/test/fixtures/dockerenv/docker-compose-nopkcs11-test.yaml b/test/fixtures/dockerenv/docker-compose-nopkcs11-test.yaml index bbec1c716f..b315c3271e 100644 --- a/test/fixtures/dockerenv/docker-compose-nopkcs11-test.yaml +++ b/test/fixtures/dockerenv/docker-compose-nopkcs11-test.yaml @@ -8,7 +8,8 @@ version: '2.1' services: integration-tests: - image: ${FABRIC_BASE_DOCKER_REGISTRY}${FABRIC_BASEIMAGE_FIXTURE_IMAGE}:${FABRIC_ARCH}${FABRIC_ARCH_SEP}${FABRIC_BASEIMAGE_FIXTURE_TAG} + # TODO: parameterize golang version + image: golang:1.13 environment: - GO_TAGS - GO_TESTFLAGS diff --git a/test/fixtures/socat/Dockerfile b/test/fixtures/socat/Dockerfile deleted file mode 100644 index 0a62b3fe9d..0000000000 --- a/test/fixtures/socat/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright SecureKey Technologies Inc. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -ARG BASE_UBUNTU_VERSION - -FROM ubuntu:${BASE_UBUNTU_VERSION} - -ENV GOPATH=/opt/gopath \ - GOROOT=/opt/go \ - PATH=$PATH:/opt/go/bin:/opt/gopath/bin - -COPY test/fixtures/socat/install-socat.sh /tmp -RUN bash /tmp/install-socat.sh -ENTRYPOINT ["socat"] \ No newline at end of file diff --git a/test/fixtures/socat/install-socat.sh b/test/fixtures/socat/install-socat.sh deleted file mode 100644 index c1b2000681..0000000000 --- a/test/fixtures/socat/install-socat.sh +++ /dev/null @@ -1,16 +0,0 @@ -# -# Copyright SecureKey Technologies Inc. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -set -xe - -apt-get update - -ARCH=`uname -m` -if [ $ARCH = "s390x" ]; then - apt-get install -y perl -fi - -apt-get install -y --no-install-recommends socat diff --git a/test/fixtures/softhsm2/Dockerfile b/test/fixtures/softhsm2/Dockerfile index 1bac223b23..2fcb2844d1 100644 --- a/test/fixtures/softhsm2/Dockerfile +++ b/test/fixtures/softhsm2/Dockerfile @@ -4,19 +4,9 @@ # SPDX-License-Identifier: Apache-2.0 # -ARG BASE_UBUNTU_VERSION - -FROM ubuntu:${BASE_UBUNTU_VERSION} - ARG BASE_GO_VERSION -ENV GOPATH=/opt/gopath \ - GOROOT=/opt/go \ - PATH=$PATH:/opt/go/bin:/opt/gopath/bin \ - GOVER="${BASE_GO_VERSION}" - -COPY test/fixtures/softhsm2/install_go.sh /tmp -RUN /tmp/install_go.sh +FROM golang:${BASE_GO_VERSION} COPY test/fixtures/softhsm2/install-softhsm2.sh /tmp COPY scripts/_go/src/pkcs11helper /opt/workspace/pkcs11helper diff --git a/test/integration/go.mod b/test/integration/go.mod index f5e92f3cec..3c00fad4a6 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -12,7 +12,6 @@ require ( github.com/hyperledger/fabric-sdk-go v0.0.0-00010101000000-000000000000 github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.3.0 - google.golang.org/appengine v1.4.0 // indirect google.golang.org/grpc v1.23.0 )