Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit d5784ea

Browse files
Merge pull request #460 from rumpl/fix-coverage
Fix coverage on Jenkins
2 parents a66ae55 + 2a4161d commit d5784ea

4 files changed

Lines changed: 37 additions & 11 deletions

File tree

Jenkinsfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,21 @@ pipeline {
7373
dir('src/github.com/docker/app') {
7474
checkout scm
7575
sh 'make -f docker.Makefile save-invocation-image'
76+
sh 'make -f docker.Makefile INVOCATION_IMAGE_TAG=$BUILD_TAG-coverage OUTPUT=coverage-invocation-image.tar save-invocation-image-tag'
77+
sh 'make -f docker.Makefile INVOCATION_IMAGE_TAG=$BUILD_TAG-coverage-experimental OUTPUT=coverage-experimental-invocation-image.tar save-invocation-image-tag'
7678
dir('_build') {
7779
stash name: 'invocation-image', includes: 'invocation-image.tar'
80+
stash name: 'coverage-invocation-image', includes: 'coverage-invocation-image.tar'
81+
stash name: 'coverage-experimental-invocation-image', includes: 'coverage-experimental-invocation-image.tar'
7882
}
7983
}
8084
}
8185
post {
8286
always {
8387
dir('src/github.com/docker/app') {
8488
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG'
89+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage'
90+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage-experimental'
8591
}
8692
deleteDir()
8793
}
@@ -99,16 +105,17 @@ pipeline {
99105
dir('src/github.com/docker/app') {
100106
checkout scm
101107
dir('_build') {
102-
unstash "invocation-image"
103-
sh 'docker load -i invocation-image.tar'
108+
unstash "coverage-invocation-image"
109+
sh 'docker load -i coverage-invocation-image.tar'
104110
}
105-
sh 'make -f docker.Makefile coverage'
111+
sh 'make -f docker.Makefile BUILD_TAG=$BUILD_TAG-coverage coverage'
106112
archiveArtifacts '_build/ci-cov/all.out'
107113
archiveArtifacts '_build/ci-cov/coverage.html'
108114
}
109115
}
110116
post {
111117
always {
118+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage'
112119
deleteDir()
113120
}
114121
}
@@ -121,14 +128,15 @@ pipeline {
121128
dir('src/github.com/docker/app') {
122129
checkout scm
123130
dir('_build') {
124-
unstash "invocation-image"
125-
sh 'docker load -i invocation-image.tar'
131+
unstash "coverage-experimental-invocation-image"
132+
sh 'docker load -i coverage-experimental-invocation-image.tar'
126133
}
127-
sh 'make EXPERIMENTAL=on -f docker.Makefile coverage'
134+
sh 'make EXPERIMENTAL=on -f docker.Makefile BUILD_TAG=$BUILD_TAG-coverage-experimental coverage'
128135
}
129136
}
130137
post {
131138
always {
139+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage-experimental'
132140
deleteDir()
133141
}
134142
}

Jenkinsfile.baguette

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,18 @@ pipeline {
6060
dir('src/github.com/docker/app') {
6161
checkout scm
6262
sh 'make -f docker.Makefile save-invocation-image'
63+
sh 'make -f docker.Makefile save-invocation-image-tag INVOCATION_IMAGE_TAG=$BUILD_TAG-coverage OUTPUT=coverage-invocation-image.tar'
6364
dir('_build') {
6465
stash name: 'invocation-image', includes: 'invocation-image.tar'
66+
stash name: 'coverage-invocation-image', includes: 'coverage-invocation-image.tar'
6567
archiveArtifacts 'invocation-image.tar'
6668
}
6769
}
6870
}
6971
post {
7072
always {
7173
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG'
74+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage'
7275
deleteDir()
7376
}
7477
}
@@ -87,12 +90,22 @@ pipeline {
8790
steps {
8891
dir('src/github.com/docker/app') {
8992
checkout scm
90-
sh 'make -f docker.Makefile coverage'
93+
dir('_build') {
94+
unstash "coverage-invocation-image"
95+
sh 'docker load -i coverage-invocation-image.tar'
96+
}
97+
sh 'make -f docker.Makefile BUILD_TAG=$BUILD_TAG-coverage coverage'
9198
archiveArtifacts '_build/ci-cov/all.out'
9299
archiveArtifacts '_build/ci-cov/coverage.html'
93100
sh 'curl -s https://codecov.io/bash | bash -s - -f _build/ci-cov/all.out -K'
94101
}
95102
}
103+
post {
104+
always {
105+
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage'
106+
deleteDir()
107+
}
108+
}
96109
}
97110
stage("Gradle test") {
98111
agent {

docker.Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ BUILD_ARGS=--build-arg=EXPERIMENTAL=$(EXPERIMENTAL) --build-arg=TAG=$(TAG) --bui
1919

2020
PKG_PATH := /go/src/$(PKG_NAME)
2121

22-
PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(TAG)
22+
23+
CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(BUILD_TAG)
2324
CNAB_BASE_INVOCATION_IMAGE_PATH := _build/invocation-image.tar
2425

26+
PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(TAG)
27+
2528
.DEFAULT: all
2629
all: cross test
2730

@@ -114,6 +117,10 @@ schemas: specification/bindata.go ## generate specification/bindata.go from json
114117
invocation-image:
115118
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) .
116119

120+
save-invocation-image-tag:
121+
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME) docker/cnab-app-base:$(INVOCATION_IMAGE_TAG)
122+
docker save docker/cnab-app-base:$(INVOCATION_IMAGE_TAG) -o _build/$(OUTPUT)
123+
117124
save-invocation-image: invocation-image
118125
@$(call mkdir,_build)
119126
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME) -o $(CNAB_BASE_INVOCATION_IMAGE_PATH)
@@ -125,4 +132,4 @@ push-invocation-image:
125132
help: ## this help
126133
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
127134

128-
.PHONY: lint test-e2e test-unit test cli-cross cross e2e-cross coverage gradle-test shell build_dev_image tars vendor schemas help save-invocation-image push-invocation-image
135+
.PHONY: lint test-e2e test-unit test cli-cross cross e2e-cross coverage gradle-test shell build_dev_image tars vendor schemas help invocation-image save-invocation-image save-invocation-image-tag push-invocation-image

vars.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ endif
3535
ifeq ($(TAG),)
3636
TAG := $(BUILD_TAG)
3737
endif
38-
39-
CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(BUILD_TAG)

0 commit comments

Comments
 (0)