Skip to content

Commit 66ccf58

Browse files
authored
Merge pull request #87 from RADAR-base/release-0.4.0
Release 0.4.0
2 parents 44e6f1b + 746d18d commit 66ccf58

30 files changed

+418
-153
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
.idea
44
out
55
build
6-
*/out
76
*/src/test
8-
*/build
97
*.iml
108
.gradletasknamecache

.github/workflows/main.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Continuous integration, including test and integration test
2+
name: Main test
3+
4+
# Run in master and dev branches and in all pull requests to those branches
5+
on:
6+
push:
7+
branches: [ master, dev ]
8+
pull_request:
9+
branches: [ master, dev ]
10+
11+
env:
12+
DOCKER_IMAGE: radarbase/kafka-connect-rest-fitbit-source
13+
14+
jobs:
15+
# Build and test the code
16+
kotlin:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- uses: actions/checkout@v2
24+
25+
- uses: actions/setup-java@v1
26+
with:
27+
java-version: 11
28+
29+
- name: Cache
30+
uses: actions/cache@v2
31+
with:
32+
# Cache gradle directories
33+
path: |
34+
~/.gradle/caches
35+
~/.gradle/wrapper
36+
# Key for restoring and saving the cache
37+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradlew', '**/*.gradle', 'gradle.properties', 'gradle/**') }}
38+
restore-keys: |
39+
${{ runner.os }}-gradle-
40+
41+
# Compile the code
42+
- name: Compile code
43+
run: ./gradlew assemble
44+
45+
# Gradle check
46+
- name: Check
47+
run: ./gradlew check
48+
49+
docker:
50+
# The type of runner that the job will run on
51+
runs-on: ubuntu-latest
52+
53+
# Steps represent a sequence of tasks that will be executed as part of the job
54+
steps:
55+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
56+
- uses: actions/checkout@v2
57+
58+
- name: Docker build parameters
59+
id: docker_params
60+
run: |
61+
echo "::set-output name=has_docker_login::${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
62+
if [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then
63+
echo "::set-output name=push::false"
64+
echo "::set-output name=load::true"
65+
echo "::set-output name=platforms::linux/amd64"
66+
else
67+
echo "::set-output name=push::true"
68+
echo "::set-output name=load::false"
69+
echo "::set-output name=platforms::linux/amd64,linux/arm64"
70+
fi
71+
72+
- name: Cache Docker layers
73+
id: cache_buildx
74+
uses: actions/cache@v2
75+
with:
76+
path: /tmp/.buildx-cache
77+
key: ${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-${{ hashFiles('**/Dockerfile', '**/*.gradle', 'gradle.properties', '.dockerignore', '*/src/main/**', 'docker/**') }}
78+
restore-keys: |
79+
${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-
80+
${{ runner.os }}-buildx-
81+
82+
- name: Login to Docker Hub
83+
if: steps.docker_params.outputs.has_docker_login == 'true'
84+
uses: docker/login-action@v1
85+
with:
86+
username: ${{ secrets.DOCKERHUB_USERNAME }}
87+
password: ${{ secrets.DOCKERHUB_TOKEN }}
88+
89+
# Add Docker labels and tags
90+
- name: Docker meta
91+
id: docker_meta
92+
uses: crazy-max/ghaction-docker-meta@v2
93+
with:
94+
images: ${{ env.DOCKER_IMAGE }}
95+
96+
# Setup docker build environment
97+
- name: Set up QEMU
98+
uses: docker/setup-qemu-action@v1
99+
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v1
102+
103+
- name: Cache parameters
104+
id: cache-parameters
105+
run: |
106+
if [ "${{ steps.cache_buildx.outputs.cache-hit }}" = "true" ]; then
107+
echo "::set-output name=cache-to::"
108+
else
109+
echo "::set-output name=cache-to::type=local,dest=/tmp/.buildx-cache-new,mode=max"
110+
fi
111+
112+
- name: Build docker
113+
uses: docker/build-push-action@v2
114+
with:
115+
cache-from: type=local,src=/tmp/.buildx-cache
116+
cache-to: ${{ steps.cache-parameters.outputs.cache-to }}
117+
platforms: ${{ steps.docker_params.outputs.platforms }}
118+
load: ${{ steps.docker_params.outputs.load }}
119+
push: ${{ steps.docker_params.outputs.push }}
120+
tags: ${{ steps.docker_meta.outputs.tags }}
121+
# Use runtime labels from docker_meta as well as fixed labels
122+
labels: |
123+
${{ steps.docker_meta.outputs.labels }}
124+
maintainer=Joris Borgdorff <[email protected]>, Nivethika Mahasivam <[email protected]>, Pauline Conde <[email protected]>
125+
org.opencontainers.image.description=RADAR-base upload connector backend application
126+
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Nivethika Mahasivam <[email protected]>, Pauline Conde <[email protected]>
127+
org.opencontainers.image.vendor=RADAR-base
128+
org.opencontainers.image.licenses=Apache-2.0
129+
130+
- name: Pull docker image
131+
if: steps.docker_params.outputs.load == 'false'
132+
run: docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
133+
134+
- name: Inspect docker image
135+
run: |
136+
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
137+
docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --help
138+
139+
- name: Move docker build cache
140+
if: steps.cache_buildx.outputs.cache-hit != 'true'
141+
run: |
142+
rm -rf /tmp/.buildx-cache
143+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Create release files
2+
name: Release
3+
4+
on:
5+
release:
6+
types: [ published ]
7+
8+
env:
9+
DOCKER_IMAGE: radarbase/kafka-connect-rest-fitbit-source
10+
11+
jobs:
12+
uploadBackend:
13+
# The type of runner that the job will run on
14+
runs-on: ubuntu-latest
15+
16+
# Steps represent a sequence of tasks that will be executed as part of the job
17+
steps:
18+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-java@v1
21+
with:
22+
java-version: 11
23+
24+
- name: Gradle cache
25+
uses: actions/cache@v2
26+
with:
27+
# Cache gradle directories
28+
path: |
29+
~/.gradle/caches
30+
~/.gradle/wrapper
31+
# An explicit key for restoring and saving the cache
32+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradlew', '**/*.gradle', 'gradle.properties', 'gradle/**') }}
33+
restore-keys: |
34+
${{ runner.os }}-gradle-
35+
36+
# Compile code
37+
- name: Compile code
38+
run: ./gradlew jar
39+
40+
# Upload it to GitHub
41+
- name: Upload to GitHub
42+
uses: AButler/[email protected]
43+
with:
44+
files: "*/build/libs/*"
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
# Build and push tagged release docker image
48+
docker:
49+
# The type of runner that the job will run on
50+
runs-on: ubuntu-latest
51+
52+
# Steps represent a sequence of tasks that will be executed as part of the job
53+
steps:
54+
- uses: actions/checkout@v2
55+
56+
# Setup docker build environment
57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v1
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v1
61+
62+
- name: Login to DockerHub
63+
uses: docker/login-action@v1
64+
with:
65+
username: ${{ secrets.DOCKERHUB_USERNAME }}
66+
password: ${{ secrets.DOCKERHUB_TOKEN }}
67+
68+
# Add Docker labels and tags
69+
- name: Docker meta
70+
id: docker_meta
71+
uses: crazy-max/ghaction-docker-meta@v2
72+
with:
73+
images: ${{ env.DOCKER_IMAGE }}
74+
tags: |
75+
type=semver,pattern={{version}}
76+
type=semver,pattern={{major}}.{{minor}}
77+
78+
- name: Build docker
79+
uses: docker/build-push-action@v2
80+
with:
81+
platforms: linux/amd64,linux/arm64
82+
push: true
83+
tags: ${{ steps.docker_meta.outputs.tags }}
84+
# Use runtime labels from docker_meta_backend as well as fixed labels
85+
labels: |
86+
${{ steps.docker_meta.outputs.labels }}
87+
maintainer=Joris Borgdorff <[email protected]>, Nivethika Mahasivam <[email protected]>, Pauline Conde <[email protected]>
88+
org.opencontainers.image.description=RADAR-base upload connector backend application
89+
org.opencontainers.image.authors=Joris Borgdorff <[email protected]>, Nivethika Mahasivam <[email protected]>, Pauline Conde <[email protected]>
90+
org.opencontainers.image.vendor=RADAR-base
91+
org.opencontainers.image.licenses=Apache-2.0
92+
93+
- name: Inspect image
94+
run: |
95+
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
96+
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}

Dockerfile

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,32 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM openjdk:8-alpine as builder
15+
FROM gradle:7.2-jdk11 as builder
1616

1717
RUN mkdir /code
1818
WORKDIR /code
1919

20-
ENV GRADLE_OPTS -Dorg.gradle.daemon=false
20+
ENV GRADLE_USER_HOME=/code/.gradlecache \
21+
GRADLE_OPTS="-Dorg.gradle.vfs.watch=false"
2122

22-
COPY ./gradle/wrapper /code/gradle/wrapper
23-
COPY ./gradlew /code/
24-
RUN ./gradlew --version
25-
26-
COPY ./build.gradle ./settings.gradle /code/
23+
COPY ./build.gradle ./settings.gradle ./gradle.properties /code/
2724
COPY kafka-connect-rest-source/build.gradle /code/kafka-connect-rest-source/
28-
29-
RUN ./gradlew downloadDependencies copyDependencies
30-
3125
COPY kafka-connect-fitbit-source/build.gradle /code/kafka-connect-fitbit-source/
3226

33-
RUN ./gradlew downloadDependencies copyDependencies
27+
RUN gradle downloadDependencies copyDependencies
3428

3529
COPY ./kafka-connect-rest-source/src/ /code/kafka-connect-rest-source/src
36-
37-
RUN ./gradlew jar
38-
3930
COPY ./kafka-connect-fitbit-source/src/ /code/kafka-connect-fitbit-source/src
4031

41-
RUN ./gradlew jar
32+
RUN gradle jar
4233

43-
FROM confluentinc/cp-kafka-connect-base:5.5.2
34+
FROM confluentinc/cp-kafka-connect-base:6.2.0-3-ubi8
4435

4536
MAINTAINER Joris Borgdorff <[email protected]>
4637

4738
LABEL description="Kafka REST API Source connector"
4839

49-
ENV CONNECT_PLUGIN_PATH /usr/share/java/kafka-connect/plugins
40+
ENV CONNECT_PLUGIN_PATH=/usr/share/java/kafka-connect/plugins
5041

5142
# To isolate the classpath from the plugin path as recommended
5243
COPY --from=builder /code/kafka-connect-rest-source/build/third-party/*.jar ${CONNECT_PLUGIN_PATH}/kafka-connect-rest-source/

0 commit comments

Comments
 (0)