Merge pull request #129 from jose-bigio/build_manifest_images

Merged with https://github.com/seemethere/unir
Upstream-commit: 840f3a247d472ce692f1652da60d380613b0298f
Component: packaging
This commit is contained in:
docker-unir[bot]
2018-08-06 16:51:23 +00:00
committed by GitHub
4 changed files with 56 additions and 6 deletions

View File

@ -1,5 +1,23 @@
#!groovy
def genBranch(String arch) {
return [
"${arch}": { ->
stage("Build engine image on ${arch}") {
wrappedNode(label: "linux&&${arch}", cleanWorkspace: true) {
try {
checkout scm
sh("git clone https://github.com/moby/moby.git engine")
sh('make ENGINE_DIR=$(pwd)/engine image')
} finally {
sh('make ENGINE_DIR=$(pwd)/engine clean-image clean-engine')
}
}
}
}]
}
test_steps = [
'deb': { ->
stage('Ubuntu Xenial Debian Package') {
@ -33,4 +51,16 @@ test_steps = [
},
]
arches = [
"x86_64",
"s390x",
"ppc64le",
"aarch64",
"armhf"
]
arches.each {
test_steps << genBranch(it)
}
parallel(test_steps)

View File

@ -3,14 +3,27 @@ ENGINE_DIR:=$(CURDIR)/../engine
CLI_DIR:=$(CURDIR)/../cli
VERSION?=0.0.0-dev
DOCKER_GITCOMMIT:=abcdefg
STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
GO_VERSION:=1.10.3
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
print-% : ; @echo $($*)
.PHONY: help
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)
.PHONY: clean-engine
clean-engine:
rm -rf $(ENGINE_DIR)
.PHONY: clean-image
clean-image:
$(MAKE) ENGINE_DIR=$(ENGINE_DIR) -C image clean
.PHONY: clean
clean: ## remove build artifacts
clean: clean-engine clean-image ## remove build artifacts
$(MAKE) -C rpm clean
$(MAKE) -C deb clean
$(MAKE) -C static clean

View File

@ -4,6 +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)
ENGINE_IMAGE?=engine-community
.PHONY: help
@ -12,18 +13,24 @@ help: ## show make targets
.PHONY: clean
clean: ## remove build artifacts
docker rmi $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION)
-docker rmi $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION)
.PHONY: image
image: image-linux
$(ENGINE_DIR)/Dockerfile.engine:
cp Dockerfile.engine $(ENGINE_DIR)
# builds across multiple archs because the base images
# utilize manifests
.PHONY: image-linux
image-linux:
docker build -t $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION) \
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 ./Dockerfile $(ENGINE_DIR)
--file $< $(ENGINE_DIR)
.PHONY: release
release:
docker push $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION)
docker push $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH)