Skip to content

Commit a5e447c

Browse files
authored
Merge pull request #213 from rojkov/image-push
simplify image push
2 parents 0cda452 + aadcc62 commit a5e447c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Jenkinsfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ pipeline {
140140
script {
141141
if (env.CHANGE_ID == null) {
142142
withDockerRegistry([ credentialsId: "57e4a8b2-ccf9-4da1-a787-76dd1aac8fd1", url: "https://${REG}" ]) {
143-
sh "make images PUSH=1"
144-
sh "make demos PUSH=1"
143+
sh "make push"
145144
}
146145
}
147146
}

Makefile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,23 @@ export TAG
4949
images = $(shell ls build/docker/*.Dockerfile | sed 's/.*\/\(.\+\)\.Dockerfile/\1/')
5050

5151
$(images):
52-
ifndef PUSH
5352
@build/docker/build-image.sh $(REG)$@ $(BUILDER)
54-
else
55-
@docker push $(REG)$@
56-
endif
5753

5854
images: $(images)
5955

6056
demos = $(shell cd demo/ && ls -d */ | sed 's/\(.\+\)\//\1/g')
6157

6258
$(demos):
63-
ifndef PUSH
6459
@cd demo/ && ./build-image.sh $(REG)$@ $(BUILDER)
65-
else
66-
@docker push ${REG}$@
67-
endif
6860

6961
demos: $(demos)
7062

63+
image_tags = $(patsubst %,$(REG)%,$(images) $(demos))
64+
$(image_tags):
65+
@docker push $@
66+
67+
push: $(image_tags)
68+
7169
lock-images:
7270
@scripts/update-clear-linux-base.sh clearlinux/golang:latest $(shell ls build/docker/*.Dockerfile)
7371
@scripts/update-clear-linux-base.sh clearlinux:latest $(shell find demo -name Dockerfile)

0 commit comments

Comments
 (0)