github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/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  BAZEL_VERSIONS=0.5.2 0.5.4 0.6.1
    19  
    20  all: build
    21  
    22  do_build = \
    23  	docker build --pull --build-arg BAZEL_VERSION=$(VERSION) -t $(IMG):$(TAG)-$(VERSION) .;\
    24  	docker tag $(IMG):$(TAG)-$(VERSION) $(IMG):latest-$(VERSION);\
    25  	echo Built $(IMG):$(TAG)-$(VERSION) and tagged with latest-$(VERSION);
    26  
    27  do_push = \
    28  	gcloud docker -- push $(IMG):$(TAG)-$(VERSION);\
    29  	gcloud docker -- push $(IMG):latest-$(VERSION);\
    30  	echo Pushed $(IMG) with $(TAG)-$(VERSION) and latest-$(VERSION) tags;
    31  
    32  build:
    33  	@$(foreach VERSION,$(BAZEL_VERSIONS),$(do_build))
    34  
    35  push: build
    36  	@$(foreach VERSION,$(BAZEL_VERSIONS),$(do_push))
    37  
    38  .PHONY: all build push