Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Fix saving cnab base image to a global tmp directory and put it in a …
Browse files Browse the repository at this point in the history
…local git ignored directory (_build).

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
  • Loading branch information
silvin-lubecki committed Jan 17, 2019
1 parent 5812410 commit 880cb56
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 42 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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') {
Expand Down
54 changes: 26 additions & 28 deletions Jenkinsfile.baguette
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
Expand Down Expand Up @@ -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') {
Expand All @@ -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') {
Expand All @@ -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') {
Expand Down Expand Up @@ -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'
}
Expand Down
7 changes: 4 additions & 3 deletions docker.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 880cb56

Please sign in to comment.