Skip to content

Commit

Permalink
Merge pull request #28 from RADAR-base/master
Browse files Browse the repository at this point in the history
Merge dev into master
  • Loading branch information
Bdegraaf1234 authored Aug 1, 2024
2 parents 0ac115e + 8c0ce26 commit 93f2414
Show file tree
Hide file tree
Showing 38 changed files with 1,064 additions and 271 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
- name: Cache Docker layers
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
Expand All @@ -42,17 +42,17 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
# Allow running the image on the architectures supported by openjdk:11-jre-slim
push: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: zulu
distribution: temurin
java-version: 11
cache: maven

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: zulu
distribution: temurin
java-version: 11
cache: maven

Expand All @@ -41,27 +41,27 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
# Allow running the image on the architectures supported by openjdk:11-jre-slim
push: true
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE_IMAGE=radarbase/kafka-connect-transform-keyvalue:7.0.1
ARG BASE_IMAGE=radarbase/kafka-connect-transform-keyvalue:7.2.1

FROM maven:3.8-jdk-11 as builder
FROM --platform=$BUILDPLATFORM maven:3.8-jdk-11 as builder

# Make kafka-connect-jdbc source folder
RUN mkdir /code /code/kafka-connect-jdbc
Expand All @@ -34,7 +34,7 @@ LABEL description="Kafka JDBC connector"
ENV CONNECT_PLUGIN_PATH /usr/share/kafka-connect/plugins

# To isolate the classpath from the plugin path as recommended
COPY --from=builder /code/kafka-connect-jdbc/target/components/packages/confluentinc-kafka-connect-jdbc-10.3.1/confluentinc-kafka-connect-jdbc-10.3.1/ ${CONNECT_PLUGIN_PATH}/kafka-connect-jdbc/
COPY --from=builder /code/kafka-connect-jdbc/target/components/packages/confluentinc-kafka-connect-jdbc-10.5.2/confluentinc-kafka-connect-jdbc-10.5.2/ ${CONNECT_PLUGIN_PATH}/kafka-connect-jdbc/

# Load topics validator
COPY ./docker/kafka-wait /usr/bin/kafka-wait
Expand Down
120 changes: 68 additions & 52 deletions docker/kafka-wait
Original file line number Diff line number Diff line change
@@ -1,65 +1,81 @@
#!/bin/bash

# Check if variables exist
if [ -z "$CONNECT_ZOOKEEPER_CONNECT" ]; then
echo "CONNECT_ZOOKEEPER_CONNECT is not defined"
exit 2
max_timeout=32

IS_TEMP=0

if [ -z "$COMMAND_CONFIG_FILE_PATH" ]; then
COMMAND_CONFIG_FILE_PATH="$(mktemp)"
IS_TEMP=1
fi

if [ -z "$CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL" ]; then
echo "CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL is not defined"
exit 4
if [ ! -f "$COMMAND_CONFIG_FILE_PATH" ] || [ $IS_TEMP = 1 ]; then
while IFS='=' read -r -d '' n v; do
if [[ "$n" == "CONNECT_"* ]]; then
name="${n/CONNECT_/""}" # remove first "CONNECT_"
name="${name,,}" # lower case
name="${name//_/"."}" # replace all '_' with '.'
echo "$name=$v" >> ${COMMAND_CONFIG_FILE_PATH}
fi
done < <(env -0)
fi

KAFKA_BROKERS=${KAFKA_BROKERS:-3}
# Check if variables exist
if [ -z "$CONNECT_BOOTSTRAP_SERVERS" ]; then
echo "CONNECT_BOOTSTRAP_SERVERS is not defined"
else
KAFKA_BROKERS=${KAFKA_BROKERS:-3}

max_timeout=32
tries=10
timeout=1
while true; do
KAFKA_CHECK=$(kafka-broker-api-versions --bootstrap-server "$CONNECT_BOOTSTRAP_SERVERS" --command-config "${COMMAND_CONFIG_FILE_PATH}" | grep "(id: " | wc -l)

tries=10
timeout=1
while true; do
ZOOKEEPER_CHECK=$(zookeeper-shell ${CONNECT_ZOOKEEPER_CONNECT} <<< "ls /brokers/ids" | tail -1)
echo "Zookeeper response: ${ZOOKEEPER_CHECK}"
# ZOOKEEPER_CHECK="${ZOOKEEPER_CHECK##*$'\n'}"
ZOOKEEPER_CHECK="$(echo -e "${ZOOKEEPER_CHECK}" | tr -d '[:space:]' | tr -d '[' | tr -d ']')"
if [ "$KAFKA_CHECK" -ge "$KAFKA_BROKERS" ]; then
echo "Kafka brokers available."
break
fi

IFS=',' read -r -a array <<< ${ZOOKEEPER_CHECK}
LENGTH=${#array[@]}
if [ "$LENGTH" -eq "$KAFKA_BROKERS" ]; then
echo "Kafka brokers available."
break
fi
tries=$((tries - 1))
if [ ${tries} -eq 0 ]; then
echo "FAILED: KAFKA BROKERs NOT READY."
exit 5
fi
echo "Expected $KAFKA_BROKERS brokers but found only $KAFKA_CHECK. Waiting $timeout second before retrying ..."
sleep ${timeout}
if [ ${timeout} -lt ${max_timeout} ]; then
timeout=$((timeout * 2))
fi
done

tries=$((tries - 1))
if [ ${tries} -eq 0 ]; then
echo "FAILED: KAFKA BROKERs NOT READY."
exit 5
fi
echo "Expected $KAFKA_BROKERS brokers but found only $LENGTH. Waiting $timeout second before retrying ..."
sleep ${timeout}
if [ ${timeout} -lt ${max_timeout} ]; then
timeout=$((timeout * 2))
fi
done
echo "Kafka is available."
fi

tries=10
timeout=1
while true; do
if wget --spider -q "${CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL}/subjects" 2>/dev/null; then
echo "Schema registry available."
break
fi
tries=$((tries - 1))
if [ $tries -eq 0 ]; then
echo "FAILED TO REACH SCHEMA REGISTRY."
exit 6
fi
echo "Failed to reach schema registry. Retrying in ${timeout} seconds."
sleep ${timeout}
if [ ${timeout} -lt ${max_timeout} ]; then
timeout=$((timeout * 2))
fi
done
if [ -z "$CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL" ]; then
echo "CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL is not defined"
else
tries=10
timeout=1
while true; do
if wget --spider -q "${CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL}/subjects" 2>/dev/null; then
echo "Schema registry available."
break
fi
tries=$((tries - 1))
if [ $tries -eq 0 ]; then
echo "FAILED TO REACH SCHEMA REGISTRY."
exit 6
fi
echo "Failed to reach schema registry. Retrying in ${timeout} seconds."
sleep ${timeout}
if [ ${timeout} -lt ${max_timeout} ]; then
timeout=$((timeout * 2))
fi
done

echo "Schema registry is available."
fi

echo "Kafka is available. Ready to go!"
if [ $IS_TEMP = 1 ]; then
/bin/rm -f "$COMMAND_CONFIG_FILE_PATH"
fi
1 change: 1 addition & 0 deletions kafka-connect-jdbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Contributions can only be accepted if they contain appropriate testing. For exam

- Source Code: https://github.com/confluentinc/kafka-connect-jdbc
- Issue Tracker: https://github.com/confluentinc/kafka-connect-jdbc/issues
- Learn how to work with the connector's source code by reading our [Development and Contribution guidelines](CONTRIBUTING.md).

# Information

Expand Down
28 changes: 19 additions & 9 deletions kafka-connect-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
~ specific language governing permissions and limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -25,7 +26,7 @@
<groupId>io.confluent</groupId>
<artifactId>kafka-connect-jdbc</artifactId>
<packaging>jar</packaging>
<version>10.3.1</version>
<version>10.5.2</version>
<name>kafka-connect-jdbc</name>
<organization>
<name>Confluent, Inc.</name>
Expand All @@ -48,18 +49,20 @@
<connection>scm:git:git://github.com/confluentinc/kafka-connect-jdbc.git</connection>
<developerConnection>scm:git:[email protected]:confluentinc/kafka-connect-jdbc.git</developerConnection>
<url>https://github.com/confluentinc/kafka-connect-jdbc</url>
<tag>v10.3.1</tag>
<tag>v10.5.2</tag>
</scm>

<properties>
<derby.version>10.14.2.0</derby.version>
<commons-io.version>2.4</commons-io.version>
<kafka.connect.maven.plugin.version>0.11.1</kafka.connect.maven.plugin.version>
<sqlite-jdbc.version>3.25.2</sqlite-jdbc.version>
<postgresql.version>42.2.19</postgresql.version>
<oracle.jdbc.driver.version>19.7.0.0</oracle.jdbc.driver.version>
<mssqlserver.jdbc.driver.version>8.4.1.jre8</mssqlserver.jdbc.driver.version>
<postgresql.version>42.3.3</postgresql.version>
<jtds.driver.version>1.3.1</jtds.driver.version>
<slf4j.version>1.7.36</slf4j.version>
<reload4j.version>1.2.19</reload4j.version>
<licenses.name>Confluent Community License</licenses.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.package.home>target/${project.artifactId}-${project.version}-package</project.package.home>
Expand All @@ -73,10 +76,10 @@
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>confluent</id>
<name>Confluent</name>
<url>https://packages.confluent.io/maven/</url>
</pluginRepository>
</pluginRepositories>
Expand Down Expand Up @@ -121,7 +124,6 @@
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>${mssqlserver.jdbc.driver.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
Expand Down Expand Up @@ -169,13 +171,14 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-reload4j</artifactId>
<version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<!-- Use a repackaged version of log4j with security patches. Default log4j v1.2 is a transitive dependency of slf4j-log4j12, but it is excluded in common/pom.xml -->
<dependency>
<groupId>io.confluent</groupId>
<artifactId>confluent-log4j</artifactId>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
<version>${reload4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -201,6 +204,12 @@
<artifactId>connect-runtime</artifactId>
<version>${kafka.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
Expand Down Expand Up @@ -270,6 +279,7 @@
<configuration>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down
Loading

0 comments on commit 93f2414

Please sign in to comment.