diff --git a/Dockerfile b/Dockerfile index 76f262303..555e1c625 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,25 +32,19 @@ COPY . . # FIXME(vdemeester) change from docker-app to dev once buildkit is merged in moby/docker FROM dev AS cross ARG EXPERIMENTAL="off" -ARG TAG -ARG COMMIT -RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} cross +RUN make EXPERIMENTAL=${EXPERIMENTAL} cross # FIXME(vdemeester) change from docker-app to dev once buildkit is merged in moby/docker FROM cross AS e2e-cross ARG EXPERIMENTAL="off" # Run e2e tests -ARG TAG -ARG COMMIT -RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} e2e-cross +RUN make EXPERIMENTAL=${EXPERIMENTAL} e2e-cross # builder of invocation image entrypoint FROM build AS invocation-build COPY . . ARG EXPERIMENTAL="off" -ARG TAG -ARG COMMIT -RUN make EXPERIMENTAL=${EXPERIMENTAL} TAG=${TAG} COMMIT=${COMMIT} bin/run +RUN make EXPERIMENTAL=${EXPERIMENTAL} bin/run # cnab invocation image FROM alpine:${ALPINE_VERSION} AS invocation diff --git a/Jenkinsfile b/Jenkinsfile index 4af8abf37..a8870ac30 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,7 +68,9 @@ pipeline { dir('src/github.com/docker/app') { checkout scm sh 'make -f docker.Makefile save-invocation-image' - stash name: 'invocation-image', includes: 'invocation-image.tar' + dir('_build'){ + stash name: 'invocation-image', includes: 'invocation-image*.tar' + } } } post { @@ -134,7 +136,9 @@ pipeline { steps { dir('src/github.com/docker/app') { checkout scm - unstash "invocation-image" + dir('_build'){ + unstash "invocation-image" + } sh 'make -f docker.Makefile load-invocation-image' unstash "binaries" dir('examples') { diff --git a/Jenkinsfile.baguette b/Jenkinsfile.baguette index 4d5d1753f..56b90aefa 100644 --- a/Jenkinsfile.baguette +++ b/Jenkinsfile.baguette @@ -60,12 +60,10 @@ pipeline { dir('src/github.com/docker/app') { checkout scm sh 'make -f docker.Makefile save-invocation-image' - } - dir('/tmp') { - stash name: 'invocation-image', includes: 'invocation-image-*.tar' - archiveArtifacts 'invocation-image-*.tar' - } - dir('src/github.com/docker/app') { + dir('_build') { + stash name: 'invocation-image', includes: 'invocation-image-*.tar' + archiveArtifacts 'invocation-image-*.tar' + } sh 'make -f docker.Makefile clean-invocation-image' } } @@ -97,15 +95,15 @@ pipeline { agent { label 'team-local && linux' } - environment { - DOCKERAPP_BINARY = '../docker-app-linux' - } + environment { + DOCKERAPP_BINARY = '../docker-app-linux' + } steps { - dir('/tmp') { - unstash "invocation-image" - } dir('src/github.com/docker/app') { checkout scm + dir('_build') { + unstash "invocation-image" + } sh 'make -f docker.Makefile load-invocation-image' unstash "binaries" dir('examples') { @@ -127,15 +125,15 @@ pipeline { agent { label 'team-local && mac' } - environment { - DOCKERAPP_BINARY = '../docker-app-darwin' - } + environment { + DOCKERAPP_BINARY = '../docker-app-darwin' + } steps { - dir('/tmp') { - unstash "invocation-image" - } dir('src/github.com/docker/app') { checkout scm + dir('_build') { + unstash "invocation-image" + } sh 'make -f docker.Makefile load-invocation-image' unstash "binaries" dir('examples') { @@ -157,15 +155,15 @@ pipeline { agent { label 'team-local && windows && linux-containers' } - environment { - DOCKERAPP_BINARY = '../docker-app-windows.exe' - } + environment { + DOCKERAPP_BINARY = '../docker-app-windows.exe' + } steps { - dir('/tmp') { - unstash "invocation-image" - } dir('src/github.com/docker/app') { checkout scm + dir('_build') { + unstash "invocation-image" + } bat 'make -f docker.Makefile load-invocation-image' unstash "binaries" dir('examples') { @@ -199,11 +197,11 @@ pipeline { } steps{ sh 'docker login --username "${DOCKERHUB_CREDS_USR}" --password "${DOCKERHUB_CREDS_PSW}"' - dir('/tmp') { - unstash "invocation-image" - } dir('src/github.com/docker/app') { - checkout scm + checkout scm + dir('_build') { + unstash "invocation-image" + } sh 'make -f docker.Makefile load-invocation-image' sh 'make -f docker.Makefile push-invocation-image' } diff --git a/docker.Makefile b/docker.Makefile index 123247054..3c2581fa4 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -13,17 +13,16 @@ E2E_CROSS_CTNR_NAME := $(BIN_NAME)-e2e-cross-$(TAG) COV_CTNR_NAME := $(BIN_NAME)-cov-$(TAG) SCHEMAS_CTNR_NAME := $(BIN_NAME)-schemas-$(TAG) - BUILD_ARGS=--build-arg=EXPERIMENTAL=$(EXPERIMENTAL) --build-arg=TAG=$(TAG) --build-arg=COMMIT=$(COMMIT) PKG_PATH := /go/src/$(PKG_NAME) CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(TAG) -CNAB_BASE_INVOCATION_IMAGE_PATH := /tmp/invocation-image-$(TAG).tar +CNAB_BASE_INVOCATION_IMAGE_PATH := ./_build/invocation-image-$(TAG).tar RM := rm ifeq ($(OS),Windows_NT) - CNAB_BASE_INVOCATION_IMAGE_PATH := c:\tmp\invocation-image-$(TAG).tar + CNAB_BASE_INVOCATION_IMAGE_PATH := .\_build\invocation-image-$(TAG).tar RM := del endif @@ -109,9 +108,11 @@ invocation-image: docker build $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) . save-invocation-image: invocation-image + @$(call mkdir,_build) docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME) -o $(CNAB_BASE_INVOCATION_IMAGE_PATH) load-invocation-image: + @$(call mkdir,_build) docker load -i $(CNAB_BASE_INVOCATION_IMAGE_PATH) $(RM) $(CNAB_BASE_INVOCATION_IMAGE_PATH)