-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
144 lines (114 loc) · 4.26 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#
# Use bash explicitly in this Makefile to avoid unexpected platform
# incompatibilities among Linux distros.
#
SHELL := /bin/bash
VERSION := 2.1.0
LAST_RELEASED_IMAGE_NAME := hawtio/online
LAST_RELEASED_VERSION ?= 1.12.0
CONTROLLER_GEN_VERSION := v0.6.1
OPERATOR_SDK_VERSION := v1.26.1
KUSTOMIZE_VERSION := v4.5.4
OPM_VERSION := v1.24.0
IMAGE_NAME ?= quay.io/hawtio/online
GATEWAY_IMAGE_NAME ?= quay.io/hawtio/online-gateway
# Replace SNAPSHOT with the current timestamp
DATETIMESTAMP=$(shell date -u '+%Y%m%d-%H%M%S')
VERSION := $(subst -SNAPSHOT,-$(DATETIMESTAMP),$(VERSION))
GATEWAY_DOCKERFILE=Dockerfile-gateway
NGINX_DOCKERFILE=Dockerfile-nginx
#
# Situations when user wants to override
# the image name and version
# - used in kustomize install
# - need to preserve original image and version as used in other files
#
CUSTOM_IMAGE ?= $(IMAGE_NAME)
CUSTOM_GATEWAY_IMAGE ?= $(GATEWAY_IMAGE_NAME)
CUSTOM_VERSION ?= $(VERSION)
RELEASE_GIT_REMOTE := origin
GIT_COMMIT := $(shell if [ -d .git ]; then git rev-list -1 HEAD; else echo "$(CUSTOM_VERSION)"; fi)
LINT_GOGC := 10
LINT_DEADLINE := 10m
define LICENSE_HEADER
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
endef
export LICENSE_HEADER
default: build
kubectl:
ifeq (, $(shell command -v kubectl 2> /dev/null))
$(error "No kubectl found in PATH. Please install and re-run")
endif
kustomize:
ifeq (, $(shell command -v kustomize 2> /dev/null))
$(error "No kustomize found in PATH. Please install and re-run")
else
KUSTOMIZE=$(shell command -v kustomize 2> /dev/null)
endif
yarn:
ifeq (, $(shell command -v yarn 2> /dev/null))
$(error "No yarn found in PATH. Please install and re-run")
else
YARN=$(shell command -v yarn 2> /dev/null)
endif
setup: yarn
yarn install
build: setup
@echo "####### Building hawtio/online ..."
yarn build:online
clean:
rm -rf $(PACKAGES)/$(ONLINE_SHELL)/build
lint: setup
yarn lint
lint-fix: setup
yarn lint:fix
format: setup
yarn format:check
format-fix: setup
yarn format:fix
check-licenses:
./script/check_licenses.sh
image:
@echo "####### Building Hawtio Online container image..."
docker build -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION) -f Dockerfile-nginx .
image-push: image
docker push $(CUSTOM_IMAGE):$(CUSTOM_VERSION)
image-gateway:
@echo "####### Building Hawtio Online Gateway container image..."
docker build -t $(CUSTOM_GATEWAY_IMAGE):$(CUSTOM_VERSION) -f Dockerfile-gateway .
image-gateway-push: image-gateway
docker push $(CUSTOM_GATEWAY_IMAGE):$(CUSTOM_VERSION)
get-image:
@echo $(CUSTOM_IMAGE)
get-version:
@echo $(CUSTOM_VERSION)
set-version:
./script/set_version.sh $(CUSTOM_VERSION) $(CUSTOM_IMAGE)
git-tag:
./script/git_tag.sh $(CUSTOM_VERSION) $(RELEASE_GIT_REMOTE)
.PHONY: kubectl kustomize yarn setup build clean lint lint-fix format format-fix check-licenses image image-push get-image get-version set-version git-tag