-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (92 loc) · 4.04 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
REPOS= ${CURDIR}/build/repos
SOURCES= ${CURDIR}/sources
WHEELS= ${CURDIR}/wheels
INDEX= $(WHEELS)/simple
VENV?= "${HOME}/.virtualenvs/eduid-releng"
TAGSUFFIX?= testing
STAGINGTAG?= staging
PRODTAG?= production
MAINBRANCH= origin/main
BRANCH?= $(MAINBRANCH)
SUBMODULES= eduid-backend eduid-html eduid-front eduid-managed-accounts
DOCKERS= webapp worker satosa_scim fastapi admintools html
DATETIME:= $(shell date -u +%Y%m%dT%H%M%S)
VERSION?= $(DATETIME)
all:
$(info --- INFO: eduID release engineering ---)
$(info ---)
$(info --- INFO: The main targets of this Makefile are: )
$(info ---)
$(info --- update_what_to_build: Update what code will be built to the upstream branch $(BRANCH) ---)
$(info --- dockers: Build docker images $(DOCKERS) ---)
$(info ---)
build_prep:
git submodule update --init
git submodule update
git submodule foreach "git show --summary"
update_what_to_build: build_prep
git pull
git submodule foreach "git checkout ${MAINBRANCH}"
git submodule foreach "git fetch origin"
git submodule foreach "git checkout ${BRANCH}"
git submodule foreach "git show --summary"
for mod in $(SUBMODULES); do git commit -m "updated submodule $${mod} to branch ${BRANCH}" build/repos/$${mod} || true; done
deinit_submodules:
cd ${REPOS} && for mod in $(SUBMODULES); do git submodule deinit -f $${mod}; done
init_submodules:
mkdir -p "${REPOS}"
cd "${REPOS}"; for mod in $(SUBMODULES); do git submodule add https://github.com/SUNET/$${mod}.git; done
clean:
docker rmi eduid-prebuild -f
real_clean: clean init_submodules
prebuild:
cd prebuild && make docker
build: build_prep prebuild
git submodule status > build/submodules.txt
cd build && make VERSION=$(VERSION) docker
webapp:
cd webapp && make VERSION=$(VERSION) docker
worker:
cd worker && make VERSION=$(VERSION) docker
satosa_scim:
cd satosa_scim && make VERSION=$(VERSION) docker
fastapi:
cd fastapi && make VERSION=$(VERSION) docker
admintools:
cd admintools && make VERSION=$(VERSION) docker
html:
cd html && make VERSION=$(VERSION) docker
dockers: build $(DOCKERS)
dockers_tagpush:
cd webapp && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
cd worker && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
cd satosa_scim && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
cd fastapi && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
cd admintools && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
cd html && make VERSION=$(VERSION) TAGSUFFIX=$(TAGSUFFIX) docker_tagpush
@echo ""
@echo "--- INFO: eduID release engineering ---"
@echo "---"
@echo "--- Docker images for version $(VERSION) built and pushed)"
@echo "---"
@echo "--- Probable next step:"
@echo "---"
@echo "--- make VERSION=$(VERSION) staging_release"
@echo "---"
@echo "--- in the eduid-releng repository"
@echo "---"
staging_release:
cd webapp && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
cd worker && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
cd satosa_scim && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
cd fastapi && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
cd admintools && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
cd html && make VERSION=$(VERSION) SRCTAG=$(TAGSUFFIX) DSTTAG=$(STAGINGTAG) tag_copypush
production_release:
cd webapp && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
cd worker && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
cd satosa_scim && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
cd fastapi && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
cd admintools && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
cd html && make VERSION=$(VERSION) SRCTAG=$(STAGINGTAG) DSTTAG=$(PRODTAG) tag_copypush
.PHONY: prebuild build $(DOCKERS) staging_release production_release