-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
112 lines (91 loc) · 3.84 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
# Copyright 2017-present SIGHUP s.r.l
#
# 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.
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SHELL := /bin/sh
PROJECT_NAME := gangplank
.DEFAULT_GOAL := help
# ----------------------------------------------------------------------------------------------------------------------
# Private variables
# ----------------------------------------------------------------------------------------------------------------------
_DOCKER_FILELINT_IMAGE=cytopia/file-lint:latest-0.8
_DOCKER_HADOLINT_IMAGE=hadolint/hadolint:v2.12.0
_DOCKER_JSONLINT_IMAGE=cytopia/jsonlint:1.6
_DOCKER_MAKEFILELINT_IMAGE=cytopia/checkmake:latest-0.5
_DOCKER_MARKDOWNLINT_IMAGE=davidanson/markdownlint-cli2:v0.8.1
_DOCKER_SHELLCHECK_IMAGE=koalaman/shellcheck-alpine:v0.9.0
_DOCKER_SHFMT_IMAGE=mvdan/shfmt:v3-alpine
_DOCKER_YAMLLINT_IMAGE=cytopia/yamllint:1
_DOCKER_CHART_TESTING_IMAGE=quay.io/helmpack/chart-testing:v3.9.0
# TODO: replace this image with a permission-monitor-specific one
_DOCKER_TOOLS_IMAGE=omissis/go-jsonschema:tools-latest
_PROJECT_DIRECTORY=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# ----------------------------------------------------------------------------------------------------------------------
# Utility functions
# ----------------------------------------------------------------------------------------------------------------------
#1: docker image
#2: script name
define run-script-docker
@docker run --rm \
-v ${_PROJECT_DIRECTORY}:/data \
-w /data \
--entrypoint /bin/sh \
$(1) scripts/$(2).sh
endef
# check-variable-%: Check if the variable is defined.
check-variable-%:
@[[ "${${*}}" ]] || (echo '*** Please define variable `${*}` ***' && exit 1)
# ----------------------------------------------------------------------------------------------------------------------
# Linting Targets
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: license-check
license-check:
@addlicense -c "SIGHUP s.r.l" -y 2017-present -v -l apache \
-ignore "deployments/helm/templates/**/*" \
-ignore "dist/**/*" \
-ignore ".go/**/*" \
--check .
# ----------------------------------------------------------------------------------------------------------------------
# Formatting Targets
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: license-add
license-add:
@addlicense -c "SIGHUP s.r.l" -y 2017-present -v -l apache \
-ignore "deployments/helm/templates/**/*" \
-ignore "dist/**/*" \
-ignore ".go/**/*" \
.
# ----------------------------------------------------------------------------------------------------------------------
# Golang Targets
# ----------------------------------------------------------------------------------------------------------------------
.PHONY: tools-go
tools-go:
@scripts/tools-golang.sh
.PHONY: tools-brew
tools-brew:
@scripts/tools-brew.sh
.PHONY: build
build:
@scripts/build.sh
.PHONY: release
release:
@scripts/release.sh
# -------------------------------------------------------------------------------------------------
# Development Targets
# -------------------------------------------------------------------------------------------------
.PHONY: dev-up
dev-up:
@scripts/dev-up.sh
.PHONY: dev-down
dev-down:
@scripts/dev-down.sh