Skip to content

Commit cc31e54

Browse files
committed
Update CI
1 parent 5d240cd commit cc31e54

File tree

5 files changed

+118
-95
lines changed

5 files changed

+118
-95
lines changed

.docker/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM eclipse-temurin:21-jre-alpine
2+
3+
LABEL org.opencontainers.image.authors="Michelin"
4+
5+
COPY target/kafka-streams-processing-error-handling.jar /app/kafka-streams-processing-error-handling.jar
6+
7+
RUN apk update \
8+
&& echo -e "#!/bin/sh\n\njava -jar /app/kafka-streams-processing-error-handling.jar \"\$@\"" > /usr/bin/kafka-streams-processing-error-handling \
9+
&& chmod +x /usr/bin/kafka-streams-processing-error-handling \
10+
&& apk upgrade \
11+
&& rm -rf /var/cache/apk/*
12+
13+
ENTRYPOINT ["kafka-streams-processing-error-handling"]

.github/workflows/build.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
10+
schedule:
11+
- cron: '0 5 * * 1'
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout project
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up JDK 21
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: '21'
27+
distribution: 'temurin'
28+
cache: maven
29+
30+
- name: Cache SonarQube packages
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.sonar/cache
34+
key: ${{ runner.os }}-sonar
35+
restore-keys: ${{ runner.os }}-sonar
36+
37+
- name: Cache Maven packages
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.m2
41+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
42+
restore-keys: ${{ runner.os }}-m2
43+
44+
- name: Lint
45+
run: mvn spotless:check
46+
47+
- name: Build
48+
run: mvn clean package
49+
50+
- name: Publish test report
51+
if: always()
52+
uses: mikepenz/action-junit-report@v5
53+
with:
54+
report_paths: '**/target/surefire-reports/TEST-*.xml'
55+
56+
- name: Grype source code
57+
id: grype_source_code
58+
uses: anchore/scan-action@v6
59+
with:
60+
path: .
61+
fail-build: true
62+
severity-cutoff: high
63+
only-fixed: true
64+
65+
- name: Upload Grype source code report
66+
if: always() && steps.grype_source_code.outputs.sarif != ''
67+
uses: github/codeql-action/upload-sarif@v3
68+
with:
69+
sarif_file: ${{ steps.grype_source_code.outputs.sarif }}
70+
category: 'source-code'
71+
72+
- name: Metadata
73+
id: metadata
74+
run: echo current_version=$(echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)) >> $GITHUB_OUTPUT
75+
76+
- name: Docker build
77+
run: docker build -f .docker/Dockerfile -t michelin/kafka-streams-processing-error-handling:${{ steps.metadata.outputs.current_version }} .
78+
79+
- name: Grype Docker image
80+
id: grype_docker_image
81+
uses: anchore/scan-action@v6
82+
with:
83+
image: michelin/kafka-streams-processing-error-handling:${{ steps.metadata.outputs.current_version }}
84+
fail-build: true
85+
severity-cutoff: high
86+
only-fixed: true
87+
88+
- name: Upload Grype Docker image report
89+
if: always() && steps.grype_docker_image.outputs.sarif != ''
90+
uses: github/codeql-action/upload-sarif@v3
91+
with:
92+
sarif_file: ${{ steps.grype_docker_image.outputs.sarif }}
93+
category: 'docker-image'
94+
95+
- name: Docker login
96+
if: github.ref == 'refs/heads/main'
97+
uses: docker/login-action@v3
98+
with:
99+
username: ${{ secrets.DOCKER_USER }}
100+
password: ${{ secrets.DOCKER_TOKEN }}
101+
102+
- name: Docker push
103+
if: github.ref == 'refs/heads/main'
104+
run: docker push michelin/kafka-streams-processing-error-handling:${{ steps.metadata.outputs.current_version }}

.github/workflows/pull_request.yml

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

.github/workflows/push_main.yml

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

pom.xml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<version>1.0.0</version>
88

99
<properties>
10-
<jib-maven-plugin.version>3.4.5</jib-maven-plugin.version>
1110
<junit-jupiter.version>5.12.1</junit-jupiter.version>
1211
<kafka-streams.version>4.0.0</kafka-streams.version>
1312
<logback.version>1.5.17</logback.version>
@@ -60,6 +59,7 @@
6059
</dependencies>
6160

6261
<build>
62+
<finalName>${project.artifactId}</finalName>
6363
<plugins>
6464
<plugin>
6565
<groupId>com.diffplug.spotless</groupId>
@@ -111,24 +111,6 @@
111111
</execution>
112112
</executions>
113113
</plugin>
114-
115-
<plugin>
116-
<groupId>com.google.cloud.tools</groupId>
117-
<artifactId>jib-maven-plugin</artifactId>
118-
<version>${jib-maven-plugin.version}</version>
119-
<configuration>
120-
<from>
121-
<image>eclipse-temurin:21-jre-alpine</image>
122-
</from>
123-
<to>
124-
<image>docker.io/michelin/${project.artifactId}:${project.version}</image>
125-
<tags>
126-
<tag>latest</tag>
127-
</tags>
128-
</to>
129-
</configuration>
130-
</plugin>
131114
</plugins>
132115
</build>
133-
134116
</project>

0 commit comments

Comments
 (0)