Skip to content

Commit ccca6ec

Browse files
committed
Manual merge 0.1.x into master
2 parents 7367108 + fa4251a commit ccca6ec

File tree

6 files changed

+70
-89
lines changed

6 files changed

+70
-89
lines changed

Dockerfile-confluenthub

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
# limitations under the License.
1515

1616
ARG CP_VERSION
17+
ARG BASE_PREFIX=confluentinc
18+
ARG CONNECT_IMAGE=cp-kafka-connect
1719

18-
FROM confluentinc/cp-kafka-connect:$CP_VERSION
20+
FROM $BASE_PREFIX/$CONNECT_IMAGE:$CP_VERSION
1921

2022
ENV CONNECT_PLUGIN_PATH="/usr/share/java,/usr/share/confluent-hub-components"
2123

Dockerfile renamed to Dockerfile-local

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
# limitations under the License.
1515

1616
ARG CP_VERSION
17+
ARG BASE_PREFIX=confluentinc
18+
ARG CONNECT_IMAGE=cp-kafka-connect
1719

18-
FROM confluentinc/cp-kafka-connect:$CP_VERSION
20+
FROM $BASE_PREFIX/$CONNECT_IMAGE:$CP_VERSION
1921

2022
ENV CONNECT_PLUGIN_PATH="/usr/share/java,/usr/share/confluent-hub-components"
2123

Dockerfile-operator

Lines changed: 0 additions & 23 deletions
This file was deleted.

Dockerfile-operator-local

Lines changed: 0 additions & 25 deletions
This file was deleted.

Makefile

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,76 @@ SHELL=/bin/bash -o pipefail
88

99
check-dependency = $(if $(shell command -v $(1)),,$(error Make sure $(1) is installed))
1010

11-
check-dependencies:
12-
@#(call check-dependency,mvn)
13-
@#(call check-dependency,docker)
14-
@#(call check-dependency,grep)
15-
@#(call check-dependency,cut)
16-
@#(call check-dependency,sed)
17-
1811
CP_VERSION ?= 5.3.1
1912
OPERATOR_VERSION ?= 0
20-
KAFKA_CONNECT_DATAGEN_VERSION ?= 0.1.6
13+
14+
KAFKA_CONNECT_DATAGEN_VERSION ?= 0.2.0
2115
AGGREGATE_VERSION = $(KAFKA_CONNECT_DATAGEN_VERSION)-$(CP_VERSION)
2216
OPERATOR_AGGREGATE_VERSION = $(AGGREGATE_VERSION).$(OPERATOR_VERSION)
2317

2418
KAFKA_CONNECT_DATAGEN_LOCAL_VERSION = $(shell make local-package-version)
2519
AGGREGATE_LOCAL_VERSION = $(KAFKA_CONNECT_DATAGEN_LOCAL_VERSION)-$(CP_VERSION)
2620

21+
BASE_PREFIX ?= confluentinc
22+
PUSH_PREFIX ?= cnfldemos
23+
2724
help:
2825
@$(foreach m,$(MAKEFILE_LIST),grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(m) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-$(HELP_TAB_WIDTH)s\033[0m %s\n", $$1, $$2}';)
2926

30-
local-package-version: check-dependencies ## Retrieves the jar version from the maven project definition
27+
local-package-version: ## Retrieves the jar version from the maven project definition
3128
@mvn help:evaluate -Dexpression=project.version -q -DforceStdout
3229

33-
package: check-dependencies ## Creates the assembly jar
30+
package: ## Creates the assembly jar
3431
@mvn clean package
3532

36-
build-docker-from-local: check-dependencies package ## Build the Docker image using the locally mvn built kafka-connect-datagen package
37-
@docker build -t kafka-connect-datagen:$(AGGREGATE_LOCAL_VERSION) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_LOCAL_VERSION) --build-arg CP_VERSION=$(CP_VERSION) -f Dockerfile .
33+
build-docker-from-local: package ## Build the Docker image using the locally mvn built kafka-connect-datagen package
34+
@docker build -t kafka-connect-datagen:$(AGGREGATE_LOCAL_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_LOCAL_VERSION) --build-arg CP_VERSION=$(CP_VERSION) -f Dockerfile-local .
35+
36+
build-docker-from-released: ## Build a Docker image using a released version of the kafka-connect-datagen connector
37+
@docker build -t kafka-connect-datagen:$(AGGREGATE_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) -f Dockerfile-confluenthub .
38+
39+
build-cp-server-connect-from-local: package ## Build the Docker image based on cp-server-connect from locally mvn built kafka-connect-datagen package
40+
@docker build -t cp-server-connect-datagen:$(AGGREGATE_LOCAL_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_LOCAL_VERSION) --build-arg CP_VERSION=$(CP_VERSION) --build-arg CONNECT_IMAGE=cp-server-connect -f Dockerfile-local .
41+
42+
build-cp-server-connect-from-released: ## Build a Docker image using a released version of the kafka-connect-datagen connector
43+
@docker build -t cp-server-connect-datagen:$(AGGREGATE_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) --build-arg CONNECT_IMAGE=cp-server-connect -f Dockerfile-confluenthub .
44+
45+
# In the case of Operator based images, there is an additional REV version appended to the end of the CP Version
46+
# which allows Operator images to rev independently
47+
48+
build-cp-server-connect-operator-from-local: package ## Build the Docker image based on cp-server-connect from locally mvn built kafka-connect-datagen package
49+
@docker build -t cp-server-connect-operator-datagen:$(AGGREGATE_LOCAL_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_LOCAL_VERSION) --build-arg CP_VERSION=$(CP_VERSION).$(OPERATOR_VERSION) --build-arg CONNECT_IMAGE=cp-server-connect-operator -f Dockerfile-local .
50+
51+
build-cp-server-connect-operator-from-released: ## Build a Docker image using a released version of the kafka-connect-datagen connector
52+
@docker build -t cp-server-connect-operator-datagen:$(AGGREGATE_VERSION) --build-arg BASE_PREFIX=$(BASE_PREFIX) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION).$(OPERATOR_VERSION) --build-arg CONNECT_IMAGE=cp-server-connect-operator -f Dockerfile-confluenthub .
53+
54+
push-from-local:
55+
@make --no-print-directory build-docker-from-local
56+
@docker tag kafka-connect-datagen:$(AGGREGATE_LOCAL_VERSION) $(PUSH_PREFIX)/kafka-connect-datagen:$(AGGREGATE_LOCAL_VERSION)
57+
@docker push $(PUSH_PREFIX)/kafka-connect-datagen:$(AGGREGATE_LOCAL_VERSION)
58+
59+
push-from-released:
60+
@make --no-print-directory build-docker-from-released
61+
@docker tag kafka-connect-datagen:$(AGGREGATE_VERSION) $(PUSH_PREFIX)/kafka-connect-datagen:$(AGGREGATE_VERSION)
62+
@docker push $(PUSH_PREFIX)/kafka-connect-datagen:$(AGGREGATE_VERSION)
3863

39-
build-docker-from-released: check-dependencies ## Build a Docker image using a released version of the kafka-connect-datagen connector
40-
@docker build -t kafka-connect-datagen:$(AGGREGATE_VERSION) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) -f Dockerfile-confluenthub .
64+
push-cp-server-connect-from-local:
65+
@make --no-print-directory build-cp-server-connect-from-local
66+
@docker tag cp-server-connect-datagen:$(AGGREGATE_LOCAL_VERSION) $(PUSH_PREFIX)/cp-server-connect-datagen:$(AGGREGATE_LOCAL_VERSION)
67+
@docker push $(PUSH_PREFIX)/cp-server-connect-datagen:$(AGGREGATE_LOCAL_VERSION)
4168

42-
publish-cp-kafka-connect-confluenthub: check-dependencies ## Build the cp-kafka-connect image pulling datagen from Confluent Hub
43-
@docker build -t cnfldemos/kafka-connect-datagen:$(AGGREGATE_VERSION) --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) -f Dockerfile-confluenthub .
44-
@docker push cnfldemos/kafka-connect-datagen:$(AGGREGATE_VERSION)
69+
push-cp-server-connect-from-released:
70+
@make --no-print-directory build-cp-server-connect-from-released
71+
@docker tag cp-server-connect-datagen:$(AGGREGATE_VERSION) $(PUSH_PREFIX)/cp-server-connect-datagen:$(AGGREGATE_VERSION)
72+
@docker push $(PUSH_PREFIX)/cp-server-connect-datagen:$(AGGREGATE_VERSION)
4573

46-
# The combination of CP_VERSION & OPERATOR_VERSION will determine two things:
47-
# 1. The version of the operator base image used in the Dockerfiles for operator (Dockerfile-operator-local & Dockerfile-operator)
48-
# 2. The version of the docker images _this_ repository builds and pushes to cnfldemos (cp-server-connect-operator-with-datagen)
74+
push-cp-server-connect-operator-from-local:
75+
@make --no-print-directory build-cp-server-connect-operator-from-local
76+
@docker tag cp-server-connect-operator-datagen:$(AGGREGATE_LOCAL_VERSION) $(PUSH_PREFIX)/cp-server-connect-operator-datagen:$(AGGREGATE_LOCAL_VERSION)
77+
@docker push $(PUSH_PREFIX)/cp-server-connect-operator-datagen:$(AGGREGATE_LOCAL_VERSION)
4978

50-
publish-cp-server-connect-operator-confluenthub: check-dependencies ## Build the cp-server-connect-operator image pulling datagen from Confluent Hub
51-
@docker build -t cnfldemos/cp-server-connect-operator-with-datagen:$(AGGREGATE_VERSION).0 --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) --build-arg OPERATOR_VERSION=$(OPERATOR_VERSION) -f Dockerfile-operator .
52-
@docker push cnfldemos/cp-server-connect-operator-with-datagen:$(OPERATOR_AGGREGATE_VERSION)
79+
push-cp-server-connect-operator-from-released:
80+
@make --no-print-directory build-cp-server-connect-operator-from-released
81+
@docker tag cp-server-connect-operator-datagen:$(AGGREGATE_VERSION) $(PUSH_PREFIX)/cp-server-connect-operator-datagen:$(AGGREGATE_VERSION)
82+
@docker push $(PUSH_PREFIX)/cp-server-connect-operator-datagen:$(AGGREGATE_VERSION)
5383

54-
publish-cp-server-connect-operator-local: check-dependencies ## Build the cp-server-connect-operator image installing datagen from the local build
55-
@docker build -t cnfldemos/cp-server-connect-operator-with-datagen:$(AGGREGATE_VERSION).0 --build-arg KAFKA_CONNECT_DATAGEN_VERSION=$(KAFKA_CONNECT_DATAGEN_VERSION) --build-arg CP_VERSION=$(CP_VERSION) --build-arg OPERATOR_VERSION=$(OPERATOR_VERSION) -f Dockerfile-operator-local .
56-
@docker push cnfldemos/cp-server-connect-operator-with-datagen:$(OPERATOR_AGGREGATE_VERSION)

README.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,29 @@ confluent local consume test1 --value-format avro --max-messages 5 --property pr
6363

6464
A Docker image based on Kafka Connect with the `kafka-connect-datagen` plugin is already available in [Dockerhub](https://hub.docker.com/r/cnfldemos/kafka-connect-datagen), and it is ready for you to use.
6565

66-
If you want to build a local copy of the Docker image with `kafka-connect-datagen`, this project provides a [Dockerfile](Dockerfile) that you can reference.
66+
If you want to build a local copy of the Docker image with `kafka-connect-datagen`, this project provides a [Dockerfile](Dockerfile-local) that you can reference.
6767

68-
You can create a Docker image packaged with the locally built source by running:
68+
You can create a Docker image packaged with the locally built source by running (for example with the 5.3.1 version of Confluent Platform):
6969
```bash
70-
make build-docker-from-local
70+
make build-docker-from-local CP_VERSION=5.3.1
7171
```
7272

73-
This will build the connector from source and create a local image with an aggregate version number. The aggregate version number is the kafka-connect-datagen connector version number and the Confluent Platform version number separated with a `-`. The local kafka-connect-datagen version number is defined in the `pom.xml` file, and the Confluent Platform version defined in the [Makefile](Makfile). An example of the aggregate version number might be: `0.1.6-5.3.1`.
73+
This will build the connector from source and create a local image with an aggregate version number. The aggregate version number is the kafka-connect-datagen connector version number and the Confluent Platform version number separated with a `-`. The local kafka-connect-datagen version number is defined in the `pom.xml` file, and the Confluent Platform version defined in the [Makefile](Makfile). An example of the aggregate version number might be: `0.1.7-5.3.1`.
7474

7575
Alternatively, you can install the `kafka-connect-datagen` connector from [Confluent Hub](https://www.confluent.io/connector/kafka-connect-datagen/) into a Docker image by running:
7676
```bash
77-
make build-docker-from-released
77+
make build-docker-from-released CP_VERSION=5.3.1
7878
```
7979

8080
The [Makefile](Makefile) contains some default variables that affect the version numbers of both the installed `kafka-connect-datagen` as well as the base Confluent Platform version. The variables are located near the top of the [Makefile](Makefile) with the following names and current default values:
8181

8282
```bash
8383
CP_VERSION ?= 5.3.1
84+
8485
KAFKA_CONNECT_DATAGEN_VERSION ?= 0.2.0
8586
```
8687
These values can be overriden with variable declarations before the `make` command. For example:
88+
8789
```bash
8890
KAFKA_CONNECT_DATAGEN_VERSION=0.2.0 make build-docker-from-released
8991
```
@@ -220,13 +222,13 @@ The [Makefile](Makefile) contains some default variables that affect the version
220222

221223
```bash
222224
CP_VERSION ?= 5.3.1
223-
KAFKA_CONNECT_DATAGEN_VERSION ?= 0.1.6
225+
KAFKA_CONNECT_DATAGEN_VERSION ?= 0.1.7
224226
OPERATOR_VERSION ?= 0 # Operator is a 'rev' version appended at the end of the CP version, like so: 5.3.1.0
225227
```
226228

227229
To publish the https://hub.docker.com/r/cnfldemos/kafka-connect-datagen/ image:
228230
```bash
229-
make publish-cp-kafka-connect-confluenthub
231+
make push-from-released
230232
```
231233

232234
and to override the CP Version of the `kafka-connect-datagen` version you can run something similar to:
@@ -236,11 +238,7 @@ CP_VERSION=5.3.0 KAFKA_CONNECT_DATAGEN_VERSION=0.1.4 make publish-cp-kafka-conne
236238

237239
to override the CP Version and the Operator version, which may happen if Operator releases a patch version, you could run something similar to:
238240
```bash
239-
CP_VERSION=5.3.0 OPERATOR_VERSION=1 KAFKA_CONNECT_DATAGEN_VERSION=0.1.4 make publish-cp-server-connect-operator-confluenthub
241+
CP_VERSION=5.3.0 OPERATOR_VERSION=1 KAFKA_CONNECT_DATAGEN_VERSION=0.1.4 make push-cp-server-connect-operator-from-released
240242
```
241-
which would result in a docker image tagged as: `cp-server-connect-operator-with-datagen:0.1.4-5.3.0.1`
243+
which would result in a docker image tagged as: `cp-server-connect-operator-datagen:0.1.4-5.3.0.1` and pushed to DockerHub
242244

243-
To publish the https://hub.docker.com/r/cnfldemos/cp-server-connect-operator-with-datagen image:
244-
```bash
245-
make publish-cp-server-connect-operator-confluenthub
246-
```

0 commit comments

Comments
 (0)