Skip to content

Commit fc64d55

Browse files
authored
Infra: Migrate build system from maven to gradle (#884)
2 parents d91483b + d49627b commit fc64d55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1177
-347
lines changed

.devcontainer/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"features": {
77
"ghcr.io/devcontainers/features/java:1": {
88
"version": "none",
9-
"installMaven": "true",
10-
"installGradle": "false"
9+
"installMaven": "false",
10+
"installGradle": "true"
1111
},
1212
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
1313
},

.github/CODEOWNERS

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33

44
# BACKEND
5-
/pom.xml @kafbat/backend
5+
/build.gradle @kafbat/backend
6+
/gradle.properties @kafbat/backend
7+
/settings.gradle @kafbat/backend
8+
/gradle/ @kafbat/backend
69
/contract/ @kafbat/backend
710
/api/ @kafbat/backend
811
/serde-api/ @kafbat/backend

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33

4-
- package-ecosystem: maven
4+
- package-ecosystem: gradle
55
directory: "/"
66
schedule:
77
interval: weekly

.github/workflows/aws_ami_publish.yml

-77
This file was deleted.

.github/workflows/backend_main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ on:
44
push:
55
branches: [ "main" ]
66
paths:
7-
- "pom.xml"
7+
- "build.gradle"
8+
- "gradle.properties"
9+
- "settings.gradle"
10+
- "gradle/libs.versions.toml"
11+
812
- "contract/**"
913
- "api/**"
1014
- "serde-api/**"

.github/workflows/backend_pr.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
pull_request_target:
66
types: [ "opened", "reopened", "synchronize" ]
77
paths:
8-
- "pom.xml"
8+
- "build.gradle"
9+
- "gradle.properties"
10+
- "settings.gradle"
11+
- "gradle/libs.versions.toml"
12+
913
- "contract/**"
1014
- "api/**"
1115
- "serde-api/**"

.github/workflows/backend_tests.yml

+6-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Backend: build and test"
1+
name: "Backend: tests & sonar"
22

33
on:
44
workflow_call:
@@ -30,40 +30,12 @@ jobs:
3030
with:
3131
java-version: '21'
3232
distribution: 'zulu'
33-
cache: 'maven'
33+
cache: 'gradle'
3434

35-
- name: Cache SonarCloud packages
36-
uses: actions/cache@v4
37-
with:
38-
path: ~/.sonar/cache
39-
key: ${{ runner.os }}-sonar
40-
restore-keys: ${{ runner.os }}-sonar
41-
42-
- name: "Pull request: Maven tests & sonar"
43-
if: ${{ inputs.event_name == 'pull_request' || inputs.event_name == 'pull_request_target' }}
44-
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
47-
HEAD_REF: ${{ github.head_ref }}
48-
BASE_REF: ${{ github.base_ref }}
49-
SKIP_SONAR: "true" # TODO remove when public
35+
- name: "Tests"
5036
run: |
51-
./mvnw -B -ntp versions:set -DnewVersion=${{ github.event.pull_request.head.sha }}
52-
./mvnw -B -V -ntp verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
53-
-Dsonar.skip=${SKIP_SONAR} \
54-
-Dsonar.projectKey=io.kafbat:kafbat-ui_backend \
55-
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
56-
-Dsonar.pullrequest.branch=$HEAD_REF \
57-
-Dsonar.pullrequest.base=$BASE_REF
37+
./gradlew :api:test --info
5838
59-
- name: "Main: Maven tests & sonar"
60-
if: ${{ inputs.event_name == 'push' }}
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
64-
SKIP_SONAR: "true" # TODO remove when public
39+
- name: "Sonar"
6540
run: |
66-
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
67-
./mvnw -B -V -ntp verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
68-
-Dsonar.skip=${SKIP_SONAR} \
69-
-Dsonar.projectKey=io.kafbat:kafbat-ui_backend
41+
./gradlew sonar --info

.github/workflows/block_merge.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ jobs:
1010
with:
1111
mode: exactly
1212
count: 0
13-
labels: "status/blocked, status/needs-attention, status/on-hold, status/pending, status/triage, status/pending-backend, status/pending-frontend, status/pending-QA"
13+
labels: >
14+
status/blocked,
15+
status/needs-attention,
16+
status/on-hold,
17+
status/pending,
18+
status/triage,
19+
status/pending-backend,
20+
status/pending-frontend,
21+
status/pending-QA

.github/workflows/branch-deploy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
java-version: '21'
3333
distribution: 'zulu'
34-
cache: 'maven'
34+
cache: 'gradle'
3535
- name: Build
3636
id: build
3737
run: |
@@ -69,7 +69,7 @@ jobs:
6969
push: true
7070
tags: 297478128798.dkr.ecr.eu-central-1.amazonaws.com/kafka-ui:${{ steps.extract_branch.outputs.tag }}
7171
build-args: |
72-
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
72+
JAR_FILE=build/libs/api-${{ steps.build.outputs.version }}.jar
7373
cache-from: type=local,src=/tmp/.buildx-cache
7474
cache-to: type=local,dest=/tmp/.buildx-cache
7575
outputs:

.github/workflows/build-public-image.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
java-version: '21'
3131
distribution: 'zulu'
32-
cache: 'maven'
32+
cache: 'gradle'
3333
- name: Build
3434
id: build
3535
run: |
@@ -68,7 +68,7 @@ jobs:
6868
push: true
6969
tags: ${{ vars.ECR_REGISTRY }}/${{ github.repository }}:${{ steps.extract_branch.outputs.tag }}
7070
build-args: |
71-
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
71+
JAR_FILE=build/libs/api-${{ steps.build.outputs.version }}.jar
7272
cache-from: type=local,src=/tmp/.buildx-cache
7373
cache-to: type=local,dest=/tmp/.buildx-cache
7474
- name: make comment with private deployment link

.github/workflows/codeql-analysis.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ on:
88
# The branches below must be a subset of the branches above
99
branches: [ main ]
1010
paths:
11+
- "build.gradle"
12+
- "gradle.properties"
13+
- "settings.gradle"
14+
- "gradle/libs.versions.toml"
15+
1116
- 'frontend/**'
12-
- "pom.xml"
17+
1318
- "contract/**"
1419
- 'api/**'
1520
- 'serde-api/**'
@@ -24,7 +29,7 @@ permissions:
2429

2530
jobs:
2631
analyze:
27-
name: Analyze
32+
name: CodeQL Analyze
2833
runs-on: ubuntu-latest
2934
strategy:
3035
fail-fast: false
@@ -47,7 +52,7 @@ jobs:
4752
with:
4853
java-version: '21'
4954
distribution: 'zulu'
50-
cache: 'maven'
55+
cache: 'gradle'
5156

5257
- name: Autobuild
5358
uses: github/codeql-action/autobuild@v3

.github/workflows/cve_checks.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ jobs:
2727
with:
2828
java-version: '21'
2929
distribution: 'zulu'
30-
cache: 'maven'
30+
cache: 'gradle'
3131

3232
- name: Build project
3333
id: build
3434
run: |
35-
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
36-
./mvnw -B -V -ntp clean package -DskipTests
37-
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
38-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
35+
./gradlew clean build \
36+
-x test \
37+
-Pbuild-docker-images=true \
38+
-Pinclude-frontend=true \
39+
-Pversion=latest
3940
4041
- name: Set up QEMU
4142
uses: docker/setup-qemu-action@v3
@@ -60,16 +61,16 @@ jobs:
6061
push: false
6162
load: true
6263
tags: |
63-
ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }}
64+
ghcr.io/kafbat/kafka-ui:latest
6465
build-args: |
65-
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
66+
JAR_FILE=build/libs/api-latest.jar
6667
cache-from: type=local,src=/tmp/.buildx-cache
6768
cache-to: type=local,dest=/tmp/.buildx-cache
6869

6970
- name: Run CVE checks
7071
uses: aquasecurity/[email protected]
7172
with:
72-
image-ref: "ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }}"
73+
image-ref: "ghcr.io/kafbat/kafka-ui:latest"
7374
format: "table"
7475
exit-code: "1"
7576

.github/workflows/docker_build.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
ref: ${{ github.event.pull_request.head.sha }}
2424
token: ${{ github.token }}
2525

26-
- name: Download maven artifacts
26+
- name: Download artifacts
2727
uses: actions/download-artifact@v4
2828
with:
2929
name: kafbat-ui-${{ inputs.version }}
30-
path: api/target
30+
path: api/build/libs
3131

3232
- name: Set up QEMU
3333
uses: docker/setup-qemu-action@v3
@@ -44,9 +44,10 @@ jobs:
4444
restore-keys: |
4545
${{ runner.os }}-buildx-
4646
47-
# Build multi platform images and loading them at the same time is not possible with default container runtime : https://github.com/docker/buildx/issues/59
47+
# Build multi-platform images and loading them at the same time is not possible with default container runtime : https://github.com/docker/buildx/issues/59
4848
# So let's use containerd instead as it supports this option
49-
# Also containerd is one of the option to allow preserving provenance attestations :https://docs.docker.com/build/attestations/#creating-attestations
49+
# Also containerd is one of the option to allow preserving provenance attestations:
50+
# https://docs.docker.com/build/attestations/#creating-attestations
5051
- name: Setup docker with containerd
5152
uses: crazy-max/ghaction-setup-docker@v3
5253
with:
@@ -71,7 +72,7 @@ jobs:
7172
tags: |
7273
kafka-ui:temp
7374
build-args: |
74-
JAR_FILE=api-${{ inputs.version }}.jar
75+
JAR_FILE=build/libs/api-${{ inputs.version }}.jar
7576
cache-from: type=local,src=/tmp/.buildx-cache
7677
cache-to: type=local,dest=/tmp/.buildx-cache
7778

0 commit comments

Comments
 (0)