From 20a2b3f5938fa908c351c45e0064044c045ce7cc Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 12:01:54 +0100 Subject: [PATCH 01/10] Test on docker 1.12 with Travis --- .travis.yml | 24 +++++++++++++++++------- Makefile | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88a1508..98168a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ go: - "1.10" services: - - docker + - docker go_import_path: "github.com/ibm-messaging/mq-container" @@ -13,6 +13,14 @@ cache: directories: - downloads +env: + - DOCKER_DOWNGRADE=echo nothing to be done + - DOCKER_DOWNGRADE=sudo apt-get autoremove -y docker-ce & + curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - & + sudo apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" & + sudo apt-get update & + sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) + before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" @@ -26,11 +34,13 @@ install: - echo nothing script: - - make deps - - make vet - - make build-devserver - - make test-devserver + - make deps + - make vet + - make build-devserver + - make build-devjmstest + - exec $DOCKER_DOWNGRADE + - make test-devserver after_success: - - go get golang.org/x/lint/golint - - make lint + - go get golang.org/x/lint/golint + - make lint diff --git a/Makefile b/Makefile index e82a7ec..a067a23 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ build-devjmstest: cd test/messaging && docker build --tag $(DEV_JMS_IMAGE) . .PHONY: test-devserver -test-devserver: test/docker/vendor build-devjmstest +test-devserver: test/docker/vendor $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER) on Docker"$(END))) cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) DEV_JMS_IMAGE=$(DEV_JMS_IMAGE) go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER) From d61cc9c6867fea2720401e4704c6f3160403f85f Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 12:34:11 +0100 Subject: [PATCH 02/10] Add quotes to env command --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98168a8..c086cb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,12 @@ cache: - downloads env: - - DOCKER_DOWNGRADE=echo nothing to be done - - DOCKER_DOWNGRADE=sudo apt-get autoremove -y docker-ce & + - DOCKER_DOWNGRADE=\"echo nothing to be done\" + - DOCKER_DOWNGRADE=\"sudo apt-get autoremove -y docker-ce & curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - & sudo apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" & sudo apt-get update & - sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) + sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)\" before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -38,7 +38,7 @@ script: - make vet - make build-devserver - make build-devjmstest - - exec $DOCKER_DOWNGRADE + - $DOCKER_DOWNGRADE - make test-devserver after_success: From c9e7ae194e83c2f0f82d84377dc545d1dc974faf Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 12:50:11 +0100 Subject: [PATCH 03/10] Fix quotes escape in .travis.yml --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c086cb1..b22bcbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,12 @@ cache: - downloads env: - - DOCKER_DOWNGRADE=\"echo nothing to be done\" - - DOCKER_DOWNGRADE=\"sudo apt-get autoremove -y docker-ce & + - DOCKER_DOWNGRADE="echo nothing to be done" + - DOCKER_DOWNGRADE="sudo apt-get autoremove -y docker-ce & curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - & - sudo apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" & + sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" & sudo apt-get update & - sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)\" + sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)" before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -39,6 +39,7 @@ script: - make build-devserver - make build-devjmstest - $DOCKER_DOWNGRADE + - echo Running $(docker --version) - make test-devserver after_success: From 1cba6639228ea371ef38c23e29c58d583f2917c6 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 15:07:36 +0100 Subject: [PATCH 04/10] Minor corrections --- .travis.yml | 8 ++------ Makefile | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b22bcbe..f659f22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,7 @@ cache: env: - DOCKER_DOWNGRADE="echo nothing to be done" - - DOCKER_DOWNGRADE="sudo apt-get autoremove -y docker-ce & - curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add - & - sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" & - sudo apt-get update & - sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)" + - DOCKER_DOWNGRADE="sudo apt-get autoremove -y docker-ce && curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - && sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && sudo apt-get update && sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)" before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -38,7 +34,7 @@ script: - make vet - make build-devserver - make build-devjmstest - - $DOCKER_DOWNGRADE + - eval "$DOCKER_DOWNGRADE" - echo Running $(docker --version) - make test-devserver diff --git a/Makefile b/Makefile index a067a23..a40cc48 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ ARCH = $(shell uname -m) BUILD_SERVER_CONTAINER=build-server # NUM_CPU is the number of CPUs available to Docker. Used to control how many # test run in parallel -NUM_CPU=$(shell docker info --format "{{ .NCPU }}") +NUM_CPU=$(shell docker info --format "{{ .NCPU }}" || 1) # BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE))) MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG) From 4826e83c9ea07b8c38afac13cc1e6b1446d6abbf Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 15:27:22 +0100 Subject: [PATCH 05/10] Use ?= for NUM_CPU --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a40cc48..d7b4396 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,8 @@ ARCH = $(shell uname -m) BUILD_SERVER_CONTAINER=build-server # NUM_CPU is the number of CPUs available to Docker. Used to control how many # test run in parallel -NUM_CPU=$(shell docker info --format "{{ .NCPU }}" || 1) +NUM_CPU = $(shell docker info --format "{{ .NCPU }}") +NUM_CPU ?= 2 # BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE))) MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG) From 9d46e6e25a228e3bf362bd494d11baaa0dd3de12 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 15:41:31 +0100 Subject: [PATCH 06/10] Fix makefile --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d7b4396..3f69e9a 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,7 @@ ARCH = $(shell uname -m) BUILD_SERVER_CONTAINER=build-server # NUM_CPU is the number of CPUs available to Docker. Used to control how many # test run in parallel -NUM_CPU = $(shell docker info --format "{{ .NCPU }}") -NUM_CPU ?= 2 +NUM_CPU = $(or $(shell docker info --format "{{ .NCPU }}"),2) # BASE_IMAGE_TAG is a normalized version of BASE_IMAGE, suitable for use in a Docker tag BASE_IMAGE_TAG=$(subst /,-,$(subst :,-,$(BASE_IMAGE))) MQ_IMAGE_DEVSERVER_BASE=mqadvanced-server-dev-base:$(MQ_VERSION)-$(ARCH)-$(BASE_IMAGE_TAG) From 363c8487dfd37a458b1af795aab82d871a675ed9 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 16:37:03 +0100 Subject: [PATCH 07/10] Set DOCKER_API_VERSION in travis --- .travis.yml | 3 +-- Makefile | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f659f22..00488c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ cache: env: - DOCKER_DOWNGRADE="echo nothing to be done" - - DOCKER_DOWNGRADE="sudo apt-get autoremove -y docker-ce && curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - && sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && sudo apt-get update && sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs)" + - DOCKER_API_VERSION="1.24" DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test && sudo apt-get autoremove -y docker-ce && curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - && sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && sudo apt-get update && sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) && docker load -q -i mqadvanced-server-dev.tar" before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - @@ -35,7 +35,6 @@ script: - make build-devserver - make build-devjmstest - eval "$DOCKER_DOWNGRADE" - - echo Running $(docker --version) - make test-devserver after_success: diff --git a/Makefile b/Makefile index 3f69e9a..4438c68 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,7 @@ test-unit: .PHONY: test-advancedserver test-advancedserver: test/docker/vendor - $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on Docker"$(END))) + $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on $(shell docker --version)"$(END))) cd test/docker && TEST_IMAGE=$(MQ_IMAGE_ADVANCEDSERVER) go test -parallel $(NUM_CPU) $(TEST_OPTS_DOCKER) .PHONY: build-devjmstest @@ -153,12 +153,12 @@ build-devjmstest: .PHONY: test-devserver test-devserver: test/docker/vendor - $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER) on Docker"$(END))) + $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_DEVSERVER) on $(shell docker --version)"$(END))) cd test/docker && TEST_IMAGE=$(MQ_IMAGE_DEVSERVER) DEV_JMS_IMAGE=$(DEV_JMS_IMAGE) go test -parallel $(NUM_CPU) -tags mqdev $(TEST_OPTS_DOCKER) .PHONY: test-advancedserver-cover test-advancedserver-cover: test/docker/vendor - $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) on Docker with code coverage"$(END))) + $(info $(SPACER)$(shell printf $(TITLE)"Test $(MQ_IMAGE_ADVANCEDSERVER) with code coverage on $(shell docker --version)"$(END))) rm -f ./coverage/unit*.cov # Run unit tests with coverage, for each package under 'internal' go list -f '{{.Name}}' ./internal/... | xargs -I {} go test -cover -covermode count -coverprofile ./coverage/unit-{}.cov ./internal/{} From 13981cef8699ba91329c3743daeabd9fb81a8b58 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 17:27:13 +0100 Subject: [PATCH 08/10] Set DOCKER_API_VERSION in DOCKER_DOWNGRADE --- .travis.yml | 15 ++++++++++++--- test.out | 0 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test.out diff --git a/.travis.yml b/.travis.yml index 00488c7..13ea98b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,18 @@ cache: directories: - downloads -env: - - DOCKER_DOWNGRADE="echo nothing to be done" - - DOCKER_API_VERSION="1.24" DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test && sudo apt-get autoremove -y docker-ce && curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - && sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && sudo apt-get update && sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) && docker load -q -i mqadvanced-server-dev.tar" +jobs: + include: + - if: type IN (pull_request) + env: DOCKER_DOWNGRADE="docker save -o images.tar mqadvanced-server-dev mq-dev-jms-test && + sudo apt-get autoremove -y docker-ce && + curl -fsSL \"https://apt.dockerproject.org/gpg\" | sudo apt-key add - && + sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && + sudo apt-get update && + sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) && + docker load -q -i mqadvanced-server-dev.tar && + export DOCKER_API_VERSION=\"1.24\"" + - env: DOCKER_DOWNGRADE="echo nothing to be done" before_install: - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - diff --git a/test.out b/test.out new file mode 100644 index 0000000..e69de29 From 0075b5b7271c7cdb349dc1d3e6e399936df8e949 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 17:29:02 +0100 Subject: [PATCH 09/10] Delete useless file --- test.out | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test.out diff --git a/test.out b/test.out deleted file mode 100644 index e69de29..0000000 From 60d098d86d4d26206e29293c2962cff27acc45d8 Mon Sep 17 00:00:00 2001 From: Riccardo Biraghi Date: Mon, 23 Apr 2018 17:43:17 +0100 Subject: [PATCH 10/10] Correct images tar archive name --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 13ea98b..18c85e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ jobs: sudo apt-add-repository \"deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main\" && sudo apt-get update && sudo apt-get install docker-engine=1.12.6-0~ubuntu-$(lsb_release -cs) && - docker load -q -i mqadvanced-server-dev.tar && + docker load -q -i images.tar && export DOCKER_API_VERSION=\"1.24\"" - env: DOCKER_DOWNGRADE="echo nothing to be done"