github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/images/bazelbuild/Makefile (about) 1 # Copyright 2016 The Kubernetes Authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 IMG = gcr.io/k8s-testimages/bazelbuild 16 TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty) 17 18 # TODO(bentheelder): retire some of these as they become unnecessary 19 LATEST_BAZEL_VERSION=0.10.0 20 BAZEL_VERSIONS=0.6.1 0.7.0 0.8.1 $(LATEST_BAZEL_VERSION) 21 22 all: build 23 24 do_build = \ 25 docker build --pull --build-arg BAZEL_VERSION=$(VERSION) --build-arg IMAGE_ARG=$(IMG):$(TAG)-$(VERSION) -t $(IMG):$(TAG)-$(VERSION) .;\ 26 docker tag $(IMG):$(TAG)-$(VERSION) $(IMG):latest-$(VERSION);\ 27 echo Built $(IMG):$(TAG)-$(VERSION) and tagged with latest-$(VERSION);\ 28 [ "$(VERSION)" == "$(LATEST_BAZEL_VERSION)" ] &&\ 29 docker tag $(IMG):$(TAG)-$(VERSION) $(IMG):latest-latest &&\ 30 echo tagged $(IMG) with latest-latest tag; 31 32 do_push = \ 33 docker push $(IMG):$(TAG)-$(VERSION);\ 34 docker push $(IMG):latest-$(VERSION);\ 35 echo Pushed $(IMG) with $(TAG)-$(VERSION) and latest-$(VERSION) tags;\ 36 [ "$(VERSION)" == "$(LATEST_BAZEL_VERSION)" ] &&\ 37 docker push $(IMG):latest-latest &&\ 38 echo Pushed $(IMG) with latest-latest tag; 39 40 build: 41 @$(foreach VERSION,$(BAZEL_VERSIONS),$(do_build)) 42 43 push: build 44 @$(foreach VERSION,$(BAZEL_VERSIONS),$(do_push)) 45 46 .PHONY: all build push