forked from gardener-attic/aws-lb-readvertiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 2.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# SPDX-FileCopyrightText: 2017 SAP SE or an SAP affiliate company and Gardener contributors
#
# SPDX-License-Identifier: Apache-2.0
IMAGE_REPOSITORY := europe-docker.pkg.dev/gardener-project/public/gardener/aws-lb-readvertiser
IMAGE_TAG := $(shell cat VERSION)
GOLANGCI_LINT_CONFIG_FILE := "./.golangci.yaml"
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################
.PHONY: install-requirements
install-requirements:
# install golangci-lint
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
.PHONY: revendor
revendor:
@go mod tidy
@go mod vendor
.PHONY: build
build:
@.ci/build
.PHONY: build-local
build-local:
@env LOCAL_BUILD=1 .ci/build
.PHONY: release
release: build build-local docker-image docker-login docker-push rename-binaries
.PHONY: docker-image
docker-image:
@if [[ ! -f bin/rel/aws-lb-readvertiser ]]; then echo "No binary found. Please run 'make build'"; false; fi
@docker build -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) --rm .
.PHONY: docker-login
docker-login:
@gcloud auth activate-service-account --key-file .kube-secrets/gcr/gcr-readwrite.json
.PHONY: docker-push
docker-push:
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(IMAGE_TAG); then echo "$(IMAGE_REPOSITORY) version $(IMAGE_TAG) is not yet built. Please run 'make docker-image'"; false; fi
@gcloud docker -- push $(IMAGE_REPOSITORY):$(IMAGE_TAG)
.PHONY: rename-binaries
rename-binaries:
@if [[ -f bin/aws-lb-readvertiser ]]; then cp bin/aws-lb-readvertiser aws-lb-readvertiser-darwin-amd64; fi
@if [[ -f bin/rel/aws-lb-readvertiser ]]; then cp bin/rel/aws-lb-readvertiser aws-lb-readvertiser-linux-amd64; fi
.PHONY: clean
clean:
@rm -rf bin/
@rm -f *linux-amd64
@rm -f *darwin-amd64
#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################
.PHONY: verify
verify: check
.PHONY: check
check:
@$(REPO_ROOT)/hack/check.sh --golangci-lint-config=$(GOLANGCI_LINT_CONFIG_FILE) . ./controller/...