-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
55 lines (41 loc) · 1.5 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
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
#
# SPDX-License-Identifier: Apache-2.0
PROJECT := ingress-default-backend
VERSION := $(shell cat VERSION)
REGISTRY := europe-docker.pkg.dev/gardener-project/public/gardener
IMAGE_REPOSITORY := $(REGISTRY)/$(PROJECT)
IMAGE_TAG := $(VERSION)
EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD)
PATH := $(GOBIN):$(PATH)
export PATH
TOOLS_DIR := hack/tools
include $(TOOLS_DIR)/tools.mk
ifneq ($(strip $(shell git status --porcelain 2>/dev/null)),)
EFFECTIVE_VERSION := $(EFFECTIVE_VERSION)-dirty
endif
.PHONY: sast
sast: $(GOSEC)
@./hack/sast.sh
.PHONY: sast-report
sast-report: $(GOSEC)
@./hack/sast.sh --gosec-report true
.PHONY: verify
verify: sast-report
.PHONY: install
install:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./hack/install.sh ./...
.PHONY: build
build: docker-image
.PHONY: release
release: docker-image docker-login docker-push
.PHONY: docker-image
docker-image:
@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)