-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
132 lines (111 loc) · 6.02 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
DOCKER_VERSION := 1
CP_VERSION := 3.0.1
VERSION := ${CP_VERSION}-${DOCKER_VERSION}
COMPONENTS := base zookeeper kafka kafka-rest schema-registry kafka-connect control-center kafkacat
COMMIT_ID := $(shell git rev-parse --short HEAD)
MYSQL_DRIVER_VERSION := 5.1.39
REPOSITORY := confluentinc
# REPOSITORY := <your_personal_repo>
clean-containers:
for container in `docker ps -aq -f label=io.confluent.docker.testing=true` ; do \
echo "\nRemoving container $${container} \n========================================== " ; \
docker rm -f $${container} || exit 1 ; \
done
clean-images:
for image in `docker images -q -f label=io.confluent.docker | uniq` ; do \
echo "Removing image $${image} \n==========================================\n " ; \
docker rmi -f $${image} || exit 1 ; \
done
debian/base/include/etc/confluent/docker/docker-utils.jar:
mkdir -p debian/base/include/etc/confluent/docker
cd java \
&& mvn clean compile package assembly:single -DskipTests \
&& cp target/docker-utils-1.0.0-SNAPSHOT-jar-with-dependencies.jar ../debian/base/include/etc/confluent/docker/docker-utils.jar \
&& cd -
build-debian: debian/base/include/etc/confluent/docker/docker-utils.jar
# We need to build images with confluentinc namespace so that dependent image builds dont fail
# and then tag the images with REPOSITORY namespace
for component in ${COMPONENTS} ; do \
echo "\n\nBuilding $${component} \n==========================================\n " ; \
docker build --build-arg COMMIT_ID=$${COMMIT_ID} --build-arg BUILD_NUMBER=$${BUILD_NUMBER} -t confluentinc/cp-$${component}:latest debian/$${component} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:latest || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${CP_VERSION} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${VERSION} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${COMMIT_ID} || exit 1 ; \
done
build-test-images:
for component in `ls tests/images` ; do \
echo "\n\nBuilding $${component} \n==========================================\n " ; \
docker build -t confluentinc/cp-$${component}:latest tests/images/$${component} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:latest || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${CP_VERSION} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${VERSION} || exit 1 ; \
docker tag confluentinc/cp-$${component}:latest ${REPOSITORY}/cp-$${component}:${COMMIT_ID} || exit 1 ; \
done
tag-remote:
ifndef DOCKER_REMOTE_REPOSITORY
$(error DOCKER_REMOTE_REPOSITORY must be defined.)
endif
for image in `docker images -f label=io.confluent.docker -f "dangling=false" --format "{{.Repository}}:{{.Tag}}"` ; do \
echo "\n Tagging $${image} as ${DOCKER_REMOTE_REPOSITORY}/$${image#*/}"; \
docker tag $${image} ${DOCKER_REMOTE_REPOSITORY}/$${image#*/}; \
done
push-private: clean build-debian build-test-images tag-remote
ifndef DOCKER_REMOTE_REPOSITORY
$(error DOCKER_REMOTE_REPOSITORY must be defined.)
endif
for image in `docker images -f label=io.confluent.docker -f "dangling=false" --format "{{.Repository}}:{{.Tag}}" | grep $$DOCKER_REMOTE_REPOSITORY` ; do \
echo "\n Pushing $${image}"; \
docker push $${image}; \
done
push-public: clean build-debian
for component in ${COMPONENTS} ; do \
echo "\n Pushing cp-$${component} \n==========================================\n "; \
docker push confluentinc/cp-$${component}:latest; \
docker push confluentinc/cp-$${component}:${VERSION}; \
docker push confluentinc/cp-$${component}:${CP_VERSION}; \
done
clean: clean-containers clean-images
rm -rf debian/base/include/etc/confluent/docker/docker-utils.jar
venv: venv/bin/activate
venv/bin/activate: tests/requirements.txt
test -d venv || virtualenv venv
venv/bin/pip install -Ur tests/requirements.txt
touch venv/bin/activate
test-docker-utils:
mkdir -p ../debian/base/include/etc/confluent/docker
cd java \
&& mvn clean compile package assembly:single \
&& src/test/bin/cli-test.sh \
&& cp target/docker-utils-1.0.0-SNAPSHOT-jar-with-dependencies.jar ../debian/base/include/etc/confluent/docker/docker-utils.jar \
&& cd -
test-build: venv clean build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_build.py -v
test-zookeeper: venv clean-containers build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_zookeeper.py -v
test-kafka: venv clean-containers build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_kafka.py -v
test-schema-registry: venv clean-containers build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_schema_registry.py -v
test-kafka-rest: venv clean-containers build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_kafka_rest.py -v
tests/fixtures/debian/kafka-connect/jars/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar:
mkdir -p tests/fixtures/debian/kafka-connect/jars
curl -k -SL "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MYSQL_DRIVER_VERSION}.tar.gz" | tar -xzf - -C tests/fixtures/debian/kafka-connect/jars --strip-components=1 mysql-connector-java-${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar
test-kafka-connect: venv clean-containers build-debian build-test-images tests/fixtures/debian/kafka-connect/jars/mysql-connector-java-${MYSQL_DRIVER_VERSION}-bin.jar
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_kafka_connect.py -v
test-control-center: venv clean-containers build-debian build-test-images
IMAGE_DIR=$(pwd) venv/bin/py.test tests/test_control_center.py -v
test-all: \
venv \
clean \
test-docker-utils \
build-debian \
build-test-images \
test-build \
test-zookeeper \
test-kafka \
test-kafka-connect \
test-schema-registry \
test-kafka-rest \
test-control-center