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

Commit 0d6d9ca

Browse files
authored
Merge pull request #31 from chris-crone/ci-tag-images
CI improvements
2 parents 924c5e2 + 07cd72d commit 0d6d9ca

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

Dockerfile.lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
ARG ALPINE_VERSION=3.7
12
ARG GO_VERSION=1.10.1
2-
ARG RUN_BASE_TAG=3.7
33

44
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS lint-base
55
RUN apk add --no-cache \

Jenkinsfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
node('gcp-linux-worker-0') {
22
stage('Build') {
33
dir('src/github.com/docker/lunchbox') {
4-
checkout scm
5-
sh 'rm -f *.tar.gz'
6-
sh 'docker image prune -f'
7-
sh 'make ci-lint'
8-
sh 'make ci-test'
9-
sh 'make ci-bin-linux'
10-
sh 'make ci-bin-darwin'
11-
sh 'make ci-bin-windows'
12-
archiveArtifacts '*.tar.gz'
4+
try {
5+
checkout scm
6+
sh 'rm -f *.tar.gz'
7+
sh 'docker image prune -f'
8+
sh 'make ci-lint'
9+
sh 'make ci-test'
10+
sh 'make ci-bin-linux'
11+
sh 'make ci-bin-darwin'
12+
sh 'make ci-bin-windows'
13+
archiveArtifacts '*.tar.gz'
14+
} finally {
15+
def clean_images = /docker image ls --format "{{.ID}}\t{{.Tag}}" | grep $(git describe --always --dirty) | awk '{print $1}' | xargs docker image rm/
16+
sh clean_images
17+
}
1318
}
1419
}
1520
}

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ clean:
7171

7272
ci-lint:
7373
@echo "Linting..."
74-
docker build -t $(IMAGE_NAME)-lint $(IMAGE_BUILD_ARGS) -f Dockerfile.lint . --target=lint-image
75-
docker run --rm $(IMAGE_NAME)-lint
74+
docker build -t $(IMAGE_NAME)-lint:$(TAG) $(IMAGE_BUILD_ARGS) -f Dockerfile.lint . --target=lint-image
75+
docker run --rm $(IMAGE_NAME)-lint:$(TAG)
7676

7777
ci-test:
7878
@echo "Testing..."
79-
docker build -t $(IMAGE_NAME)-test $(IMAGE_BUILD_ARGS) . --target=test
79+
docker build -t $(IMAGE_NAME)-test:$(TAG) $(IMAGE_BUILD_ARGS) . --target=test
8080

8181
ci-bin-%:
8282
@echo "Building tarball for $*..."
83-
docker build -t $(IMAGE_NAME)-bin-all $(IMAGE_BUILD_ARGS) . --target=bin-build
84-
docker run --rm $(IMAGE_NAME)-bin-all tar -cz $(BIN_NAME)-$*$(if $(filter windows, $*),.exe,) -C /go/src/$(PKG_NAME)/_build/$(TAG)/ > $(BIN_NAME)-$*-$(TAG).tar.gz
83+
docker build -t $(IMAGE_NAME)-bin-all:$(TAG) $(IMAGE_BUILD_ARGS) . --target=bin-build
84+
docker run --rm $(IMAGE_NAME)-bin-all:$(TAG) tar -cz $(BIN_NAME)-$*$(if $(filter windows, $*),.exe,) -C /go/src/$(PKG_NAME)/_build/$(TAG)/ > $(BIN_NAME)-$*-$(TAG).tar.gz
8585

8686
.PHONY: bin bin-all release test check lint e2e-test unit-test clean ci-lint ci-test
8787
.DEFAULT: all

0 commit comments

Comments
 (0)