-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
156 lines (115 loc) · 4.59 KB
/
Copy pathMakefile
File metadata and controls
156 lines (115 loc) · 4.59 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
# config variable
DOCKER_REPO ?= ghcr.io/citusdata
SHA_SUFFIX := $(shell git rev-parse --short HEAD)
# auto generated variables
ifdef RELEASE
TAG_SUFFIX := -v${SHA_SUFFIX}
else
TAG_SUFFIX := -dev-${SHA_SUFFIX}
endif
# all postgres versions we test against
PG_VERSIONS=$(shell cat PG_VERSIONS|cut -c 6-|tr '\n' ' ' )
PG_UPGRADE_TESTER_VERSION=$(shell echo ${PG_VERSIONS}|tr ' ' '-'|sed 's/~//g')
STYLE_CHECKER_TOOLS_VERSION=0.8.33
# Upgrade tests for the PG major versions from PG_VERSIONS file
CITUS_UPGRADE_PG_VERSIONS=$(shell head PG_VERSIONS|cut -c 6-|tr '\n' ' ')
# Latest minor version of Citus 12
CITUS_UPGRADE_VERSIONS_16=v12.1.14
# Latest minor version of Citus 13
CITUS_UPGRADE_VERSIONS_17=v13.4.0
# Latest minor version of Citus 14
CITUS_UPGRADE_VERSIONS_18=v14.2.0
# Function to get Citus versions for a specific PG major version
get_citus_versions = $(CITUS_UPGRADE_VERSIONS_$(1))
# Function to get the last Citus version for a specific PG major version
get_last_citus_version = $(lastword $(CITUS_UPGRADE_VERSIONS_$(1)))
# code below creates targets for all postgres versions in PG_VERSIONS
define make-image-targets
# $1 = PG_VERSION
# $2 = PG_MAJOR
# $3 = PG_VERSION_CLEAN
build-extbuilder-$1:
docker build \
extbuilder/ \
-f extbuilder/Dockerfile \
--build-arg=PG_VERSION=$1 \
--build-arg=PG_MAJOR=$2 \
--tag=${DOCKER_REPO}/extbuilder:$3${TAG_SUFFIX}
build-all:: build-extbuilder-$1
build-extbuilder-all:: build-extbuilder-$1
push-extbuilder-$1: build-extbuilder-$1
docker push ${DOCKER_REPO}/extbuilder:$3${TAG_SUFFIX}
push-all:: push-extbuilder-$1
push-extbuilder-all:: push-extbuilder-$1
build-exttester-$1:
docker build . \
-f exttester/Dockerfile \
--build-arg=PG_VERSION=$1 \
--build-arg=PG_MAJOR=$2 \
--build-arg=PG_VERSION_CLEAN=$3 \
--build-arg=CITUS_VERSION="$(call get_last_citus_version,$2)" \
--tag=${DOCKER_REPO}/exttester:$3${TAG_SUFFIX}
build-all:: build-exttester-$1
build-exttester-all:: build-exttester-$1
push-exttester-$1: build-exttester-$1
docker push ${DOCKER_REPO}/exttester:$3${TAG_SUFFIX}
push-all:: push-exttester-$1
push-exttester-all:: push-exttester-$1
build-failtester-$1:
docker build \
failtester/ \
-f failtester/Dockerfile \
--build-arg=PG_VERSION=$1 \
--build-arg=PG_MAJOR=$2 \
--tag=${DOCKER_REPO}/failtester:$3${TAG_SUFFIX}
build-all:: build-failtester-$1
build-failtester-all:: build-failtester-$1
push-failtester-$1: build-failtester-$1
docker push ${DOCKER_REPO}/failtester:$3${TAG_SUFFIX}
push-all:: push-failtester-$1
push-failtester-all:: push-failtester-$1
endef
# call make-image-targets($PG_VERSION, $PG_MAJOR) for every version in PG_VERSIONS
$(foreach element,$(PG_VERSIONS),$(eval $(call make-image-targets,$(element),$(shell echo $(element) | awk -F'[^0-9]*' '/[0-9]/ { print $$1 }'),$(shell echo $(element) | sed 's/~//'))))
define make-citus-upgrade-targets
# $1 = PG_VERSION
# $2 = PG_MAJOR
# $3 = PG_VERSION_CLEAN
build-citusupgradetester-$1:
docker build \
citusupgradetester/ \
-f citusupgradetester/Dockerfile \
--build-arg=PG_VERSION=$1 \
--build-arg=PG_MAJOR=$2 \
--build-arg=CITUS_VERSIONS="$(call get_citus_versions,$2)" \
--tag=${DOCKER_REPO}/citusupgradetester:$3${TAG_SUFFIX}
build-all:: build-citusupgradetester-$1
build-citusupgradetester-all:: build-citusupgradetester-$1
push-citusupgradetester-$1: build-citusupgradetester-$1
docker push ${DOCKER_REPO}/citusupgradetester:$3${TAG_SUFFIX}
push-all:: push-citusupgradetester-$1
push-citusupgradetester-all:: push-citusupgradetester-$1
endef
$(foreach element,$(CITUS_UPGRADE_PG_VERSIONS),$(eval $(call make-citus-upgrade-targets,$(element),$(shell echo $(element) | awk -F'[^0-9]*' '/[0-9]/ { print $$1 }'),$(shell echo $(element) | sed 's/~//'))))
# pg upgrade image is 1 global image
build-pgupgradetester:
docker build \
pgupgradetester/ \
-f pgupgradetester/Dockerfile \
--build-arg=PG_VERSIONS="${PG_VERSIONS}" \
--tag=${DOCKER_REPO}/pgupgradetester:${PG_UPGRADE_TESTER_VERSION}${TAG_SUFFIX}
build-all:: build-pgupgradetester
push-pgupgradetester-all: build-pgupgradetester
docker push ${DOCKER_REPO}/pgupgradetester:${PG_UPGRADE_TESTER_VERSION}${TAG_SUFFIX}
push-all:: push-pgupgradetester-all
# style checker image is 1 global image
build-stylechecker:
docker build \
stylechecker/ \
-f stylechecker/Dockerfile \
--build-arg=TOOLS_VERSION="${STYLE_CHECKER_TOOLS_VERSION}" \
--tag=${DOCKER_REPO}/stylechecker:${STYLE_CHECKER_TOOLS_VERSION}${TAG_SUFFIX}
build-all:: build-stylechecker
push-stylechecker-all: build-stylechecker
docker push ${DOCKER_REPO}/stylechecker:${STYLE_CHECKER_TOOLS_VERSION}${TAG_SUFFIX}
push-all:: push-stylechecker-all