From d72fa21d55990afc85c31d6264ac8208c620037d Mon Sep 17 00:00:00 2001 From: Jose Bigio Date: Tue, 7 Aug 2018 13:06:47 -0700 Subject: [PATCH 1/3] Add tar targets for engine image Signed-off-by: Jose Bigio Upstream-commit: 2ffde00d61af1074e100ca0c725dbd4f685299a1 Component: packaging --- components/packaging/deb/Makefile | 20 ++++++++++++-------- components/packaging/image/Makefile | 5 +++-- components/packaging/rpm/Makefile | 10 +++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index 39303bd519..b7c0bd58ed 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -28,6 +28,10 @@ clean: ## remove build artifacts [ ! -d debbuild ] || $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild $(RM) -r debbuild +engine-$(ARCH).tar: + $(MAKE) -C ../image image-linux + docker save -o $@ $(shell cat ../image/image-linux) + .PHONY: deb deb: ubuntu debian raspbian ## build all deb packages @@ -41,49 +45,49 @@ debian: debian-stretch debian-jessie ## build all debian deb packages raspbian: raspbian-stretch debian-jessie ## build all raspbian deb packages .PHONY: ubuntu-xenial -ubuntu-xenial: ## build ubuntu xenial deb packages +ubuntu-xenial: engine-$(ARCH).tar ## build ubuntu xenial deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: ubuntu-trusty -ubuntu-trusty: ## build ubuntu trusty deb packages +ubuntu-trusty: engine-$(ARCH).tar ## build ubuntu trusty deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: ubuntu-bionic -ubuntu-bionic: ## build ubuntu bionic deb packages +ubuntu-bionic: engine-$(ARCH).tar ## build ubuntu bionic deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-buster -debian-buster: ## build debian buster deb packages +debian-buster: engine-$(ARCH).tar ## build debian buster deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-jessie -debian-jessie: ## build debian jessie deb packages +debian-jessie: engine-$(ARCH).tar ## build debian jessie deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-stretch -debian-stretch: ## build debian stretch deb packages +debian-stretch: engine-$(ARCH).tar ## build debian stretch deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: raspbian-jessie -raspbian-jessie: ## build raspbian jessie deb packages +raspbian-jessie: engine-$(ARCH).tar ## build raspbian jessie deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: raspbian-stretch -raspbian-stretch: ## build raspbian stretch deb packages +raspbian-stretch: engine-$(ARCH).tar ## build raspbian stretch deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 01b3842243..1c57451c2b 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -4,7 +4,7 @@ CLI_DIR:=$(CURDIR)/../../cli VERSION?=0.0.0-dev STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) DOCKER_HUB_ORG?=docker -ARCH=$(uname -m) +ARCH=$(shell uname -m) ENGINE_IMAGE?=engine-community .PHONY: help @@ -14,6 +14,7 @@ help: ## show make targets .PHONY: clean clean: ## remove build artifacts -docker rmi $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION) + -rm -f image-linux .PHONY: image image: image-linux @@ -24,12 +25,12 @@ $(ENGINE_DIR)/Dockerfile.engine: # builds across multiple archs because the base images # utilize manifests -.PHONY: image-linux image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ --build-arg VERSION=$(STATIC_VERSION) \ --build-arg DOCKER_GITCOMMIT=$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD) \ --file $< $(ENGINE_DIR) + echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@ .PHONY: release release: diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index c0fe38599d..bcad28cfdd 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -40,20 +40,24 @@ fedora: fedora-28 fedora-27 fedora-26 ## build all fedora rpm packages .PHONY: centos centos: centos-7 ## build all centos rpm packages +engine-$(ARCH).tar: + $(MAKE) -C ../image image-linux + docker save $(shell cat ../image/image-linux) > $@ + .PHONY: fedora-28 -fedora-28: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-28 rpm packages +fedora-28: engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-28 rpm packages docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild .PHONY: fedora-27 -fedora-27: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-27 rpm packages +fedora-27:engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-27 rpm packages docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild .PHONY: centos-7 -centos-7: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build centos-7 rpm packages +centos-7:engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build centos-7 rpm packages docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild From 3570421f625123be7715a1a5053bc5e132d2a426 Mon Sep 17 00:00:00 2001 From: Jose Bigio Date: Tue, 7 Aug 2018 13:13:02 -0700 Subject: [PATCH 2/3] Remove shell directive so target will work Signed-off-by: Jose Bigio Upstream-commit: 93fcc8443b504c94beaef697ec6f27748b40d656 Component: packaging --- components/packaging/deb/Makefile | 2 +- components/packaging/image/Makefile | 4 ++++ components/packaging/rpm/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index b7c0bd58ed..70402d9802 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -30,7 +30,7 @@ clean: ## remove build artifacts engine-$(ARCH).tar: $(MAKE) -C ../image image-linux - docker save -o $@ $(shell cat ../image/image-linux) + docker save -o $@ $$(cat ../image/image-linux) .PHONY: deb deb: ubuntu debian raspbian ## build all deb packages diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 1c57451c2b..381093fc70 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -32,6 +32,10 @@ image-linux: $(ENGINE_DIR)/Dockerfile.engine --file $< $(ENGINE_DIR) echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@ +engine-$(ARCH).tar: image-linux + docker save -o $@ $$(cat $<) + + .PHONY: release release: docker push $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index bcad28cfdd..acc39144be 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -42,7 +42,7 @@ centos: centos-7 ## build all centos rpm packages engine-$(ARCH).tar: $(MAKE) -C ../image image-linux - docker save $(shell cat ../image/image-linux) > $@ + docker save -o $@ $$(cat ../image/image-linux) .PHONY: fedora-28 fedora-28: engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-28 rpm packages From 13fe238674bae8c11fa055c6f00d80af894aabc7 Mon Sep 17 00:00:00 2001 From: Jose Bigio Date: Tue, 7 Aug 2018 13:22:53 -0700 Subject: [PATCH 3/3] Add extra dollar in Makefile/image Signed-off-by: Jose Bigio Upstream-commit: 65a9bb677ebffccb2d5d1002c3e1bdd4dd46d76c Component: packaging --- components/packaging/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 381093fc70..180ee81b82 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -28,7 +28,7 @@ $(ENGINE_DIR)/Dockerfile.engine: image-linux: $(ENGINE_DIR)/Dockerfile.engine docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) \ --build-arg VERSION=$(STATIC_VERSION) \ - --build-arg DOCKER_GITCOMMIT=$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD) \ + --build-arg DOCKER_GITCOMMIT=$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD) \ --file $< $(ENGINE_DIR) echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@