From 4fba9d854535cc923bad8f32bebd8f0a2aa41030 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 6 Jul 2017 15:52:54 +0100 Subject: [PATCH] pkg: Update content trust handling. Firstly add option to disable content trust, for the use of e.g. projects which are pushing to the linuxkitprojects org (which has no trust setup) rather than the main linuxkit org. Secondly, when trust _is_ enabled then enable it globally, in particular it is now active for the `docker build` and hence containers referenced in Dockerfiles via "FROM" will be checked. Signed-off-by: Ian Campbell --- pkg/package.mk | 14 +++++++++----- projects/swarmd/swarmd/Makefile | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/package.mk b/pkg/package.mk index 350846778..d55c8fee9 100644 --- a/pkg/package.mk +++ b/pkg/package.mk @@ -24,20 +24,24 @@ else NET_OPT=--network=none endif +ifeq ($(DOCKER_CONTENT_TRUST),) +ifndef NOTRUST +export DOCKER_CONTENT_TRUST=1 +endif +endif + show-tag: @echo $(TAG) tag: $(BASE_DEPS) $(DEPS) - DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \ - docker build $(NET_OPT) -t $(TAG) . + docker pull $(TAG) || docker build $(NET_OPT) -t $(TAG) . push: tag ifneq ($(DIRTY),) $(error Your repository is not clean. Will not push package image.) endif - DOCKER_CONTENT_TRUST=1 docker pull $(TAG) || \ - DOCKER_CONTENT_TRUST=1 docker push $(TAG) + docker pull $(TAG) || docker push $(TAG) ifneq ($(RELEASE),) docker tag $(TAG) $(ORG)/$(IMAGE):$(RELEASE) - DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(RELEASE) + docker push $(ORG)/$(IMAGE):$(RELEASE) endif diff --git a/projects/swarmd/swarmd/Makefile b/projects/swarmd/swarmd/Makefile index 9550aeffe..f57b5fc59 100644 --- a/projects/swarmd/swarmd/Makefile +++ b/projects/swarmd/swarmd/Makefile @@ -1,5 +1,6 @@ ORG?=linuxkitprojects IMAGE=swarmd NETWORK=1 +NOTRUST=1 include ../../../pkg/package.mk