Skip to content

Commit

Permalink
Added gcr.io push to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
davidz627 committed Jan 10, 2018
1 parent 951f0e3 commit ce65599
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,21 @@

.PHONY: all csi-attacher clean test

IMAGE_NAME=docker.io/k8scsi/csi-attacher
IMAGE_VERSION=latest
GCR_IMAGE_PATH=gcr.io/google-containers/sig-storage/csi/external-attacher
DOCKER_IMAGE_PATH=docker.io/k8scsi/csi-attacher

IMAGE_VERSION :=
TAG := $(shell git describe --abbrev=0 --tags HEAD 2>/dev/null)
COMMIT := $(shell git rev-parse HEAD)
ifeq ($(TAG),)
IMAGE_VERSION := latest
else
ifeq ($(COMMIT), $(shell git rev-list -n1 $(TAG)))
IMAGE_VERSION := $(TAG)
else
IMAGE_VERSION := $(TAG)-$(COMMIT)
endif
endif

ifdef V
TESTARGS = -v -args -alsologtostderr -v 5
Expand All @@ -34,10 +47,15 @@ clean:

container: csi-attacher
cp csi-attacher deploy/docker
docker build -t $(IMAGE_NAME):$(IMAGE_VERSION) deploy/docker
docker build -t $(DOCKER_IMAGE_PATH):$(IMAGE_VERSION) deploy/docker

push: container
docker push $(IMAGE_NAME):$(IMAGE_VERSION)
docker push $(DOCKER_IMAGE_PATH):$(IMAGE_VERSION)

gcr-push: csi-attacher
cp bin/csi-attacher deploy/docker
docker build -t $(GCR_IMAGE_PATH):$(IMAGE_VERSION) deploy/docker
gcloud docker -- push $(GCR_IMAGE_PATH):$(IMAGE_VERSION)

test:
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
Expand Down
56 changes: 56 additions & 0 deletions Makefile.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.PHONY: all csi-attacher clean test

GCR_IMAGE_PATH=gcr.io/google-containers/volume/csi-attacher
DOCKER_IMAGE_PATH=docker.io/k8scsi/csi-attacher

IMAGE_VERSION=latest

ifdef V
TESTARGS = -v -args -alsologtostderr -v 5
else
TESTARGS =
endif


all: csi-attacher

csi-attacher:
go build -o csi-attacher cmd/csi-attacher/main.go

clean:
-rm -rf csi-attacher deploy/docker/csi-attacher

container: csi-attacher
<<<<<<< HEAD
cp csi-attacher deploy/docker
docker build -t $(IMAGE_NAME):$(IMAGE_VERSION) deploy/docker
=======
cp bin/csi-attacher deploy/docker
docker build -t $(DOCKER_IMAGE_PATH):$(IMAGE_VERSION) deploy/docker
>>>>>>> 046d7e1... Added gcr.io push to Makefile

push: container
docker push $(DOCKER_IMAGE_PATH):$(IMAGE_VERSION)

gcr-push: csi-attacher
cp bin/csi-attacher deploy/docker
docker build -t $(GCR_IMAGE_PATH):$(IMAGE_VERSION) deploy/docker
gcloud docker -- push $(GCR_IMAGE_PATH):$(IMAGE_VERSION)

test:
go test `go list ./... | grep -v 'vendor'` $(TESTARGS)
go vet `go list ./... | grep -v vendor`
Binary file added bin/csi-attacher
Binary file not shown.
Binary file added deploy/docker/csi-attacher
Binary file not shown.

0 comments on commit ce65599

Please sign in to comment.