Skip to content

Commit

Permalink
Kafka Connect: separate CI workflow (#11075)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanck committed Sep 18, 2024
1 parent f71c7df commit 40ffcb9
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 27 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/delta-conversion-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
- '.github/workflows/hive-ci.yml'
- '.github/workflows/java-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/kafka-connect-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
Expand All @@ -51,6 +52,7 @@ on:
- 'hive3-orc-bundle/**'
- 'hive-runtime/**'
- 'flink/**'
- 'kafka-connect/**'
- 'pig/**'
- 'docs/**'
- 'site/**'
Expand Down Expand Up @@ -88,7 +90,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DhiveVersions= -DflinkVersions= :iceberg-delta-lake:check -Pquick=true -x javadoc
- run: ./gradlew -DsparkVersions=3.5 -DscalaVersion=2.12 -DhiveVersions= -DkafkaVersions= -DflinkVersions= :iceberg-delta-lake:check -Pquick=true -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down Expand Up @@ -117,7 +119,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew -DsparkVersions=3.5 -DscalaVersion=2.13 -DhiveVersions= -DflinkVersions= :iceberg-delta-lake:check -Pquick=true -x javadoc
- run: ./gradlew -DsparkVersions=3.5 -DscalaVersion=2.13 -DhiveVersions= -DkafkaVersions= -DflinkVersions= :iceberg-delta-lake:check -Pquick=true -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/flink-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
- '.github/workflows/hive-ci.yml'
- '.github/workflows/java-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/kafka-connect-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
Expand All @@ -50,6 +51,7 @@ on:
- 'hive3/**'
- 'hive3-orc-bundle/**'
- 'hive-runtime/**'
- 'kafka-connect/**'
- 'spark/**'
- 'pig/**'
- 'docs/**'
Expand Down Expand Up @@ -91,7 +93,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew -DsparkVersions= -DhiveVersions= -DflinkVersions=${{ matrix.flink }} :iceberg-flink:iceberg-flink-${{ matrix.flink }}:check :iceberg-flink:iceberg-flink-runtime-${{ matrix.flink }}:check -Pquick=true -x javadoc
- run: ./gradlew -DsparkVersions= -DhiveVersions= -DkafkaVersions= -DflinkVersions=${{ matrix.flink }} :iceberg-flink:iceberg-flink-${{ matrix.flink }}:check :iceberg-flink:iceberg-flink-runtime-${{ matrix.flink }}:check -Pquick=true -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/hive-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
- '.github/workflows/flink-ci.yml'
- '.github/workflows/java-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/kafka-connect-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
Expand All @@ -49,6 +50,7 @@ on:
- 'arrow/**'
- 'spark/**'
- 'flink/**'
- 'kafka-connect/**'
- 'pig/**'
- 'docs/**'
- 'site/**'
Expand Down Expand Up @@ -86,7 +88,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew -DsparkVersions= -DhiveVersions=2 -DflinkVersions= -Pquick=true :iceberg-mr:check :iceberg-hive-runtime:check -x javadoc
- run: ./gradlew -DsparkVersions= -DhiveVersions=2 -DflinkVersions= -DkafkaVersions= -Pquick=true :iceberg-mr:check :iceberg-hive-runtime:check -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down Expand Up @@ -115,7 +117,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew -DsparkVersions= -DhiveVersions=3 -DflinkVersions= -Pquick=true :iceberg-hive3-orc-bundle:check :iceberg-hive3:check :iceberg-hive-runtime:check -x javadoc
- run: ./gradlew -DsparkVersions= -DhiveVersions=3 -DflinkVersions= -DkafkaVersions= -Pquick=true :iceberg-hive3-orc-bundle:check :iceberg-hive3:check :iceberg-hive-runtime:check -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
- '.github/workflows/flink-ci.yml'
- '.github/workflows/hive-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/kafka-connect-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
Expand Down Expand Up @@ -82,7 +83,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: ./gradlew check -DsparkVersions= -DhiveVersions= -DflinkVersions= -Pquick=true -x javadoc
- run: ./gradlew check -DsparkVersions= -DhiveVersions= -DflinkVersions= -DkafkaVersions= -Pquick=true -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/kafka-connect-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, 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.
#

name: "Kafka Connect CI"
on:
push:
branches:
- 'main'
- '0.*'
- '1.*'
- '2.*'
tags:
- 'apache-iceberg-**'
pull_request:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.github/workflows/api-binary-compatibility.yml'
- '.github/workflows/delta-conversion-ci.yml'
- '.github/workflows/flink-ci.yml'
- '.github/workflows/hive-ci.yml'
- '.github/workflows/java-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
- '.github/workflows/publish-snapshot.yml'
- '.github/workflows/recurring-jmh-benchmarks.yml'
- '.github/workflows/site-ci.yml'
- '.github/workflows/spark-ci.yml'
- '.github/workflows/stale.yml'
- '.gitignore'
- '.asf.yml'
- 'dev/**'
- 'mr/**'
- 'flink/**'
- 'hive3/**'
- 'hive3-orc-bundle/**'
- 'hive-runtime/**'
- 'spark/**'
- 'pig/**'
- 'docs/**'
- 'site/**'
- 'open-api/**'
- 'format/**'
- '.gitattributes'
- 'README.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'NOTICE'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:

kafka-connect-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
jvm: [11, 17, 21]
env:
SPARK_LOCAL_IP: localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.jvm }}
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: |
./gradlew -DsparkVersions= -DhiveVersions= -DflinkVersions= -DkafkaVersions=3 \
:iceberg-kafka-connect:iceberg-kafka-connect-events:check \
:iceberg-kafka-connect:iceberg-kafka-connect:check \
:iceberg-kafka-connect:iceberg-kafka-connect-runtime:check \
-Pquick=true -x javadoc
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test logs
path: |
**/build/testlogs
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
- run: |
./gradlew printVersion
./gradlew -DallModules publishApachePublicationToMavenRepository -PmavenUser=${{ secrets.NEXUS_USER }} -PmavenPassword=${{ secrets.NEXUS_PW }}
./gradlew -DflinkVersions= -DsparkVersions=3.3,3.4,3.5 -DscalaVersion=2.13 -DhiveVersions= publishApachePublicationToMavenRepository -PmavenUser=${{ secrets.NEXUS_USER }} -PmavenPassword=${{ secrets.NEXUS_PW }}
./gradlew -DflinkVersions= -DsparkVersions=3.3,3.4,3.5 -DscalaVersion=2.13 -DkafkaVersions=3 -DhiveVersions= publishApachePublicationToMavenRepository -PmavenUser=${{ secrets.NEXUS_USER }} -PmavenPassword=${{ secrets.NEXUS_PW }}
4 changes: 3 additions & 1 deletion .github/workflows/spark-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ on:
- '.github/workflows/hive-ci.yml'
- '.github/workflows/java-ci.yml'
- '.github/workflows/jmh-benchmarks-ci.yml'
- '.github/workflows/kafka-connect-ci.yml'
- '.github/workflows/labeler.yml'
- '.github/workflows/licence-check.yml'
- '.github/workflows/open-api.yml'
Expand All @@ -52,6 +53,7 @@ on:
- 'hive3-orc-bundle/**'
- 'hive-runtime/**'
- 'flink/**'
- 'kafka-connect/**'
- 'pig/**'
- 'docs/**'
- 'open-api/**'
Expand Down Expand Up @@ -101,7 +103,7 @@ jobs:
tool-cache: false
- run: echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- run: |
./gradlew -DsparkVersions=${{ matrix.spark }} -DscalaVersion=${{ matrix.scala }} -DhiveVersions= -DflinkVersions= \
./gradlew -DsparkVersions=${{ matrix.spark }} -DscalaVersion=${{ matrix.scala }} -DhiveVersions= -DflinkVersions= -DkafkaVersions= \
:iceberg-spark:iceberg-spark-${{ matrix.spark }}_${{ matrix.scala }}:check \
:iceberg-spark:iceberg-spark-extensions-${{ matrix.spark }}_${{ matrix.scala }}:check \
:iceberg-spark:iceberg-spark-runtime-${{ matrix.spark }}_${{ matrix.scala }}:check \
Expand Down
3 changes: 2 additions & 1 deletion dev/stage-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ SCALA_VERSION=2.12
FLINK_VERSIONS=1.18,1.19,1.20
SPARK_VERSIONS=3.3,3.4,3.5
HIVE_VERSIONS=2,3
KAFKA_VERSIONS=3

./gradlew -Prelease -DscalaVersion=$SCALA_VERSION -DflinkVersions=$FLINK_VERSIONS -DsparkVersions=$SPARK_VERSIONS -DhiveVersions=$HIVE_VERSIONS publishApachePublicationToMavenRepository
./gradlew -Prelease -DscalaVersion=$SCALA_VERSION -DflinkVersions=$FLINK_VERSIONS -DsparkVersions=$SPARK_VERSIONS -DhiveVersions=$HIVE_VERSIONS -DkafkaVersions=$KAFKA_VERSIONS publishApachePublicationToMavenRepository

# Also publish Scala 2.13 Artifacts for versions that support it.
# Flink does not yet support 2.13 (and is largely dropping a user-facing dependency on Scala). Hive doesn't need a Scala specification.
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ systemProp.defaultHiveVersions=2
systemProp.knownHiveVersions=2,3
systemProp.defaultSparkVersions=3.5
systemProp.knownSparkVersions=3.3,3.4,3.5
systemProp.defaultKafkaVersions=3
systemProp.knownKafkaVersions=3
systemProp.defaultScalaVersion=2.12
systemProp.knownScalaVersions=2.12,2.13
# enable the Gradle build cache - speeds up builds!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
import org.apache.kafka.clients.producer.ProducerRecord;
import org.assertj.core.api.Condition;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;

public class IntegrationTestBase {

private final TestContext context = TestContext.INSTANCE;
private static TestContext context;

private Catalog catalog;
private Admin admin;
private String connectorName;
Expand All @@ -70,12 +72,16 @@ protected String testTopic() {
return testTopic;
}

@BeforeAll
public static void baseBeforeAll() {
context = TestContext.instance();
}

@BeforeEach
public void baseBefore() {
catalog = context.initLocalCatalog();
producer = context.initLocalProducer();
admin = context.initLocalAdmin();

this.catalog = context.initLocalCatalog();
this.producer = context.initLocalProducer();
this.admin = context.initLocalAdmin();
this.connectorName = "test_connector-" + UUID.randomUUID();
this.testTopic = "test-topic-" + UUID.randomUUID();
}
Expand All @@ -98,7 +104,7 @@ protected void assertSnapshotProps(TableIdentifier tableIdentifier, String branc
Map<String, String> props = latestSnapshot(table, branch).summary();
assertThat(props)
.hasKeySatisfying(
new Condition<String>() {
new Condition<>() {
@Override
public boolean matches(String str) {
return str.startsWith("kafka.connect.offsets.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.time.Duration;
import java.util.Map;
import java.util.UUID;
import org.apache.iceberg.CatalogProperties;
Expand All @@ -37,7 +38,8 @@

public class TestContext {

public static final TestContext INSTANCE = new TestContext();
private static volatile TestContext instance;

public static final ObjectMapper MAPPER = new ObjectMapper();
public static final int CONNECT_PORT = 8083;

Expand All @@ -48,9 +50,17 @@ public class TestContext {
private static final String AWS_SECRET_KEY = "minioadmin";
private static final String AWS_REGION = "us-east-1";

public static synchronized TestContext instance() {
if (instance == null) {
instance = new TestContext();
}
return instance;
}

private TestContext() {
ComposeContainer container =
new ComposeContainer(new File("./docker/docker-compose.yml"))
.withStartupTimeout(Duration.ofMinutes(2))
.waitingFor("connect", Wait.forHttp("/connectors"));
container.start();
}
Expand Down
Loading

0 comments on commit 40ffcb9

Please sign in to comment.