-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
70 lines (55 loc) · 2.6 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
# global service name
SERVICE := evsexplore
#######################################################################
# OVERRIDE THIS TO MATCH YOUR PROJECT #
#######################################################################
APP_VERSION := $(shell echo `grep "^version =" web/build.gradle | sed 's/version = //'`)
VERSION := $(shell echo `grep "^version =" web/build.gradle | sed 's/version = //; s/.RELEASE//'`)
# Builds should be repeatable, therefore we need a method to reference the git
# sha where a version came from.
GIT_VERSION ?= $(shell echo `git describe --match=NeVeRmAtCh --always --dirty`)
GIT_COMMIT ?= $(shell echo `git log | grep -m1 -oE '[^ ]+$'`)
GIT_COMMITTED_AT ?= $(shell echo `git log -1 --format=%ct`)
GIT_BRANCH ?=
FULL_VERSION := v$(APP_VERSION)-g$(GIT_VERSION)
.PHONY: build
# consider also "docker save..." and "docker load..." to avoid registry.
clean:
cd web; ./gradlew clean
# Build the library without tests
build:
cd web; ./gradlew clean build -x test
# build the frontend
frontend:
/bin/rm -rf web/src/main/resources/static/*
cd frontend; ./gradlew build
# Run
run:
cd frontend; npm start
releasetag:
git tag -a "${VERSION}-RC-`/bin/date +%Y-%m-%d`" -m "Release ${VERSION}-RC-`/bin/date +%Y-%m-%d`"
git push origin "${VERSION}-RC-`/bin/date +%Y-%m-%d`"
rmreleasetag:
git tag -d "${VERSION}-RC-`/bin/date +%Y-%m-%d`"
git push origin --delete "${VERSION}-RC-`/bin/date +%Y-%m-%d`"
tag: frontend
@git diff --quiet HEAD -- || { echo "verify no repository changes on frontend build, commit changes from make frontend before running make tag"; exit 1; }
git tag -a "v`/bin/date +%Y-%m-%d`-${APP_VERSION}" -m "Release `/bin/date +%Y-%m-%d`"
git push origin "v`/bin/date +%Y-%m-%d`-${APP_VERSION}"
rmtag:
git tag -d "v`/bin/date +%Y-%m-%d`-${APP_VERSION}"
git push origin --delete "v`/bin/date +%Y-%m-%d`-${APP_VERSION}"
version:
@echo $(APP_VERSION)
scan:
trivy fs frontend/package-lock.json --format template -o report.html --template "@config/trivy/html.tpl"
grep CRITICAL report.html
cd web; ./gradlew dependencies --write-locks
trivy fs web/gradle.lockfile --format template -o reportJava.html --template "@config/trivy/html.tpl"
grep CRITICAL reportJava.html
/bin/rm -rf web/gradle.lockfile
scanJava:
cd web; ./gradlew dependencies --write-locks
trivy fs web/gradle.lockfile --format template -o reportJava.html --template "@config/trivy/html.tpl"
grep CRITICAL reportJava.html
.PHONY: frontend