Skip to content

Commit

Permalink
Merge pull request #16 from RADAR-base/sync-changes
Browse files Browse the repository at this point in the history
Sync changes from master
  • Loading branch information
mpgxvii authored May 19, 2022
2 parents 8e64d7f + e8820cf commit 0ac115e
Show file tree
Hide file tree
Showing 93 changed files with 6,821 additions and 852 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kafka-connect-jdbc/.idea
kafka-connect-jdbc/target
kafka-connect-jdbc/src/test
79 changes: 79 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master, dev]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
DOCKER_IMAGE: radarbase/radar-jdbc-connector

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Build and push tagged release docker image
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

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

# Add Docker labels and tags
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

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

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
# Allow running the image on the architectures supported by openjdk:11-jre-slim
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
context: .
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Joris Borgdorff <[email protected]>
org.opencontainers.image.authors=Pauline Conde @mpgxvii, Joris Borgdorff <[email protected]>
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master, dev]
pull_request:
branches: [master, dev]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# 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

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

- name: Build with Maven
working-directory: ./kafka-connect-jdbc
run: mvn package -DskipTests -Dcheckstyle.skip
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Create release files
name: Release

on:
release:
types: [published]

env:
DOCKER_IMAGE: radarbase/radar-jdbc-connector

jobs:
upload:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# 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
with:
distribution: zulu
java-version: 11
cache: maven

- name: Build with Maven
working-directory: ./kafka-connect-jdbc
run: mvn package -DskipTests -Dcheckstyle.skip

# Upload it to GitHub
- name: Upload to GitHub
uses: AButler/[email protected]
with:
files: 'kafka-connect-jdbc/target/components/*.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Build and push tagged release docker image
docker:
# The type of runner that the job will run on
runs-on: ubuntu-latest

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

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

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
# Allow running the image on the architectures supported by openjdk:11-jre-slim
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
context: .
# Use runtime labels from docker_meta as well as fixed labels
labels: |
${{ steps.docker_meta.outputs.labels }}
maintainer=Joris Borgdorff <[email protected]>
org.opencontainers.image.authors=Pauline Conde @mpgxvii, Joris Borgdorff <[email protected]>
org.opencontainers.image.vendor=RADAR-base
org.opencontainers.image.licenses=Apache-2.0
- name: Inspect image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.DS_Store
/docker/sink-timescale.properties
cp-kafka-connect-jdbc
12 changes: 4 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@
# 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:5.5.1
ARG BASE_IMAGE=radarbase/kafka-connect-transform-keyvalue:7.0.1

FROM maven:3.6-jdk-8 as builder
FROM maven:3.8-jdk-11 as builder

# Make kafka-connect-jdbc source folder
RUN mkdir /code /code/kafka-connect-jdbc
WORKDIR /code/kafka-connect-jdbc

# Install maven dependency packages (keep in image)
COPY kafka-connect-jdbc/pom.xml /code/kafka-connect-jdbc
RUN mvn dependency:resolve

# Package into JAR
COPY kafka-connect-jdbc/src /code/kafka-connect-jdbc/src
COPY kafka-connect-jdbc /code/kafka-connect-jdbc
RUN mvn package -DskipTests -Dcheckstyle.skip

WORKDIR /code
Expand All @@ -38,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-5.5.0/confluentinc-kafka-connect-jdbc-5.5.0/ ${CONNECT_PLUGIN_PATH}/kafka-connect-jdbc/
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/

# Load topics validator
COPY ./docker/kafka-wait /usr/bin/kafka-wait
Expand Down
2 changes: 2 additions & 0 deletions kafka-connect-jdbc/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env groovy
common {
slackChannel = '#connect-warn'
nodeLabel = 'docker-debian-jdk8'
upstreamProjects = 'confluentinc/common'
pintMerge = true
downStreamValidate = false
}
Loading

0 comments on commit 0ac115e

Please sign in to comment.