From 737e92d753866c19c264c7c62244f903a2173615 Mon Sep 17 00:00:00 2001 From: Andrew Hsu Date: Tue, 6 Jun 2017 18:33:59 +0000 Subject: [PATCH 1/5] no need for tty Signed-off-by: Andrew Hsu (cherry picked from commit ade95a2b6f8a16aa7e6c387dc9c9dd48bba9a672) Signed-off-by: Andrew Hsu --- components/packaging/deb/Makefile | 16 ++++++++-------- components/packaging/rpm/Makefile | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index da14480fcaf..0afa9a3ec0a 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -6,7 +6,7 @@ CLI_DIR:=$(CURDIR)/../../cli GITCOMMIT?=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD) VERSION?=$(shell cat $(ENGINE_DIR)/VERSION) DOCKER_EXPERIMENTAL:=0 -CHOWN:=docker run --rm -i -t -v $(CURDIR):/v -w /v $(ALPINE) chown +CHOWN:=docker run --rm -i -v $(CURDIR):/v -w /v $(ALPINE) chown .PHONY: help clean deb ubuntu debian ubuntu-xenial ubuntu-trusty ubuntu-yakkety ubuntu-zesty debian-jessie debian-stretch debian-wheezy @@ -25,7 +25,7 @@ debian: debian-stretch debian-wheezy debian-jessie ## build all debian deb packa ubuntu-xenial: ## build ubuntu xenial deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -36,7 +36,7 @@ ubuntu-xenial: ## build ubuntu xenial deb packages ubuntu-trusty: ## build ubuntu trusty deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -47,7 +47,7 @@ ubuntu-trusty: ## build ubuntu trusty deb packages ubuntu-yakkety: ## build ubuntu yakkety deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -58,7 +58,7 @@ ubuntu-yakkety: ## build ubuntu yakkety deb packages ubuntu-zesty: ## build ubuntu zesty deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -69,7 +69,7 @@ ubuntu-zesty: ## build ubuntu zesty deb packages debian-jessie: ## build debian jessie deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -80,7 +80,7 @@ debian-jessie: ## build debian jessie deb packages debian-stretch: ## build debian stretch deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ @@ -91,7 +91,7 @@ debian-stretch: ## build debian stretch deb packages debian-wheezy: ## build debian wheezy deb packages docker build -t debbuild-$@/$(ARCH) -f $(CURDIR)/$@/Dockerfile.$(ARCH) . - docker run --rm -i -t \ + docker run --rm -i \ -e VERSION=$(VERSION) \ -e DOCKER_GITCOMMIT=$(GITCOMMIT) \ -v $(CURDIR)/debbuild/$@:/build \ diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index a52f9276502..90efb836560 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -5,8 +5,8 @@ GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD) VERSION=$(shell cat $(ENGINE_DIR)/VERSION) DOCKER_EXPERIMENTAL=0 GEN_RPM_VER=$(shell ./gen-rpm-ver $(ENGINE_DIR) $(VERSION)) -CHOWN=docker run --rm -i -t -v $(CURDIR):/v -w /v alpine chown -RPMBUILD=docker run --privileged --rm -i -t \ +CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown +RPMBUILD=docker run --privileged --rm -i \ -v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES \ -v $(CURDIR)/rpmbuild/BUILD:/root/rpmbuild/BUILD \ -v $(CURDIR)/rpmbuild/BUILDROOT:/root/rpmbuild/BUILDROOT \ @@ -52,7 +52,7 @@ centos-7: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build centos-7 rpmbuild/SOURCES/cli.tgz: mkdir -p rpmbuild/SOURCES - docker run --rm -i -t -w /v \ + docker run --rm -i -w /v \ -v $(CLI_DIR):/cli \ -v $(CURDIR)/rpmbuild/SOURCES:/v \ alpine \ @@ -60,7 +60,7 @@ rpmbuild/SOURCES/cli.tgz: rpmbuild/SOURCES/engine.tgz: mkdir -p rpmbuild/SOURCES - docker run --rm -i -t -w /v \ + docker run --rm -i -w /v \ -v $(ENGINE_DIR):/engine \ -v $(CURDIR)/rpmbuild/SOURCES:/v \ alpine \ From 1f94b6c7ec295a53613a3f96b4c50b1eeea4d79b Mon Sep 17 00:00:00 2001 From: Andrew Hsu Date: Tue, 6 Jun 2017 19:54:54 +0000 Subject: [PATCH 2/5] set $GOPATH/bin for s390x Signed-off-by: Andrew Hsu (cherry picked from commit f6d30c3631abee04aa3586cba36960901f705fe2) Signed-off-by: Andrew Hsu --- components/packaging/deb/ubuntu-xenial/Dockerfile.s390x | 4 +--- components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x | 4 +--- components/packaging/deb/ubuntu-zesty/Dockerfile.s390x | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/components/packaging/deb/ubuntu-xenial/Dockerfile.s390x b/components/packaging/deb/ubuntu-xenial/Dockerfile.s390x index 9e4085d8861..08e6ded7a1d 100644 --- a/components/packaging/deb/ubuntu-xenial/Dockerfile.s390x +++ b/components/packaging/deb/ubuntu-xenial/Dockerfile.s390x @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu ENV GO_VERSION 1.8.3 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local -ENV PATH $PATH:/usr/local/go/bin - ENV GOPATH /go - +ENV PATH $PATH:/usr/local/go/bin:/$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux ENV RUNC_BUILDTAGS apparmor selinux diff --git a/components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x b/components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x index c50d678ef4d..129e58fa885 100644 --- a/components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x +++ b/components/packaging/deb/ubuntu-yakkety/Dockerfile.s390x @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu ENV GO_VERSION 1.8.3 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local -ENV PATH $PATH:/usr/local/go/bin - ENV GOPATH /go - +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 selinux ENV RUNC_BUILDTAGS apparmor selinux diff --git a/components/packaging/deb/ubuntu-zesty/Dockerfile.s390x b/components/packaging/deb/ubuntu-zesty/Dockerfile.s390x index 46ee96101e5..91f03a144fd 100644 --- a/components/packaging/deb/ubuntu-zesty/Dockerfile.s390x +++ b/components/packaging/deb/ubuntu-zesty/Dockerfile.s390x @@ -4,10 +4,8 @@ RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools bu ENV GO_VERSION 1.8.3 RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-s390x.tar.gz" | tar xzC /usr/local -ENV PATH $PATH:/usr/local/go/bin - ENV GOPATH /go - +ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux From 18355074d73aa2a2866365b40252170899285f86 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Mon, 22 May 2017 15:11:53 -0700 Subject: [PATCH 3/5] Move the hashing of files to its own target So we can use it at will Signed-off-by: Eli Uriegas (cherry picked from commit 533a843393bd7c3674074ec9af73c8e666fc7484) Conflicts: components/packaging/static/Makefile Signed-off-by: Andrew Hsu --- components/packaging/static/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/packaging/static/Makefile b/components/packaging/static/Makefile index 14711884eb7..1c8d25d952e 100644 --- a/components/packaging/static/Makefile +++ b/components/packaging/static/Makefile @@ -4,8 +4,10 @@ CLI_DIR:=$(CURDIR)/../../cli ENGINE_VER=$(shell cat $(ENGINE_DIR)/VERSION) VERSION=$(shell cat $(ENGINE_DIR)/VERSION) CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown +HASH_CMD=docker run -v $(CURDIR):/sum -it -w /sum debian:jessie bash hash_files +DIR_TO_HASH:=build/linux -.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine +.PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine hash_files help: ## show make targets @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -24,6 +26,10 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an done tar -C build/linux -c -z -f build/linux/docker-$(VERSION).tgz docker +hash_files: + @echo "Hashing directory $(DIR_TO_HASH)" + $(HASH_CMD) "$(DIR_TO_HASH)" + cross-mac: cross-all-cli ## create tgz with darwin x86_64 client only mkdir -p build/mac/docker cp $(CLI_DIR)/build/docker-darwin-amd64 build/mac/docker/docker From 723987478255583b68a9340ee7128f2a27610d29 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Mon, 22 May 2017 14:43:24 -0700 Subject: [PATCH 4/5] Add file hashing for static files Signed-off-by: Eli Uriegas (cherry picked from commit a1b7f6f3407546ff41ed2e0d16d7e1b2a8ac0ef4) Conflicts: components/packaging/static/Makefile Signed-off-by: Andrew Hsu --- components/packaging/static/Makefile | 4 ++++ components/packaging/static/hash_files | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 components/packaging/static/hash_files diff --git a/components/packaging/static/Makefile b/components/packaging/static/Makefile index 1c8d25d952e..1e7d9cdd055 100644 --- a/components/packaging/static/Makefile +++ b/components/packaging/static/Makefile @@ -25,6 +25,7 @@ static-linux: static-cli static-engine ## create tgz with linux x86_64 client an cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/binary-daemon/$$f build/linux/docker; \ done tar -C build/linux -c -z -f build/linux/docker-$(VERSION).tgz docker + $(HASH_CMD) build/linux hash_files: @echo "Hashing directory $(DIR_TO_HASH)" @@ -34,6 +35,7 @@ cross-mac: cross-all-cli ## create tgz with darwin x86_64 client only mkdir -p build/mac/docker cp $(CLI_DIR)/build/docker-darwin-amd64 build/mac/docker/docker tar -C build/mac -c -z -f build/mac/docker-$(VERSION).tgz docker + $(HASH_CMD) build/mac cross-win: cross-all-cli cross-win-engine ## create zip file with windows x86_64 client and server mkdir -p build/win/docker @@ -41,11 +43,13 @@ cross-win: cross-all-cli cross-win-engine ## create zip file with windows x86_64 cp $(ENGINE_DIR)/bundles/$(ENGINE_VER)/cross/windows/amd64/dockerd-$(ENGINE_VER).exe build/win/docker/dockerd.exe docker run --rm -v $(CURDIR)/build/win:/v -w /v alpine sh -c 'apk update&&apk add zip&&zip -r docker-$(VERSION).zip docker' $(CHOWN) -R $(shell id -u):$(shell id -g) build + $(HASH_CMD) bash hash_files build/win cross-arm: cross-all-cli ## create tgz with linux armhf client only mkdir -p build/arm/docker cp $(CLI_DIR)/build/docker-linux-arm build/arm/docker/docker tar -C build/arm -c -z -f build/arm/docker-$(VERSION).tgz docker + $(HASH_CMD) build/arm static-cli: $(MAKE) -C $(CLI_DIR) -f docker.Makefile VERSION=$(VERSION) build diff --git a/components/packaging/static/hash_files b/components/packaging/static/hash_files new file mode 100644 index 00000000000..a8851fcc0e7 --- /dev/null +++ b/components/packaging/static/hash_files @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Simple script to hash all the files in a given directory + +DIR_TO_LOOK_IN=${1:-build/linux} + +for f in $(find "$DIR_TO_LOOK_IN" -type f); do + for hash_algo in md5 sha256; do + "${hash_algo}sum" "$f" > "$f.$hash_algo" + done +done From b5411da4de76740225ccff40c18e9dfc522f30e4 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Wed, 24 May 2017 10:11:40 -0700 Subject: [PATCH 5/5] Make the hash_files target non interactive Signed-off-by: Eli Uriegas (cherry picked from commit 097516fc76a2c9acf798dc523326904520ff1fc7) Signed-off-by: Andrew Hsu --- components/packaging/static/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/packaging/static/Makefile b/components/packaging/static/Makefile index 1e7d9cdd055..0a193ccc72a 100644 --- a/components/packaging/static/Makefile +++ b/components/packaging/static/Makefile @@ -4,7 +4,7 @@ CLI_DIR:=$(CURDIR)/../../cli ENGINE_VER=$(shell cat $(ENGINE_DIR)/VERSION) VERSION=$(shell cat $(ENGINE_DIR)/VERSION) CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown -HASH_CMD=docker run -v $(CURDIR):/sum -it -w /sum debian:jessie bash hash_files +HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files DIR_TO_HASH:=build/linux .PHONY: help clean static static-linux cross-mac cross-win cross-arm static-cli static-engine cross-all-cli cross-win-engine hash_files