Skip to content

Commit 33b75b1

Browse files
authored
Merge branch 'main' into fix/conf_dirs
2 parents 77016a4 + 475caa3 commit 33b75b1

File tree

194 files changed

+2675
-3341
lines changed

Some content is hidden

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

194 files changed

+2675
-3341
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body:
2323
required: true
2424
- label: I've tried running `main`-labeled docker image and the issue still persists there
2525
required: true
26-
- label: I'm running a supported version of the application which is listed [here](https://github.com/kafbat/kafka-ui/blob/main/SECURITY.md)
26+
- label: I'm running a supported version of the application which is listed [here](https://github.com/kafbat/kafka-ui/blob/main/.github/SECURITY.md)
2727
required: true
2828

2929
- type: textarea

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body:
1919
options:
2020
- label: I've searched for an already existing issues [here](https://github.com/kafbat/kafka-ui/issues)
2121
required: true
22-
- label: I'm running a supported version of the application which is listed [here](https://github.com/kafbat/kafka-ui/blob/main/SECURITY.md) and the feature is not present there
22+
- label: I'm running a supported version of the application which is listed [here](https://github.com/kafbat/kafka-ui/blob/main/.github/SECURITY.md) and the feature is not present there
2323
required: true
2424

2525
- type: textarea

.github/workflows/branch-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: read
11+
statuses: write
1112

1213
jobs:
1314
build:

.github/workflows/e2e-manual.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "E2E: Suite run"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
test_suite:
6+
description: 'Select test suite to run'
7+
default: 'regression'
8+
required: true
9+
type: choice
10+
options:
11+
- regression
12+
- sanity
13+
- smoke
14+
15+
permissions:
16+
contents: read
17+
checks: write
18+
statuses: write
19+
20+
jobs:
21+
build-and-test:
22+
uses: ./.github/workflows/e2e-run.yml
23+
secrets: inherit
24+
with:
25+
suite_name: ${{ github.event.inputs.test_suite }}
26+
sha: ${{ github.sha }}

.github/workflows/e2e-pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "E2E: PR smoke tests"
2+
on:
3+
pull_request:
4+
types: [ "opened", "reopened", "synchronize" ]
5+
paths:
6+
- "pom.xml"
7+
- "contract/**"
8+
- "api/**"
9+
- "serde-api/**"
10+
- "frontend/**"
11+
- "e2e-tests/**"
12+
13+
permissions:
14+
contents: read
15+
checks: write
16+
statuses: write
17+
18+
jobs:
19+
build-and-test:
20+
uses: ./.github/workflows/e2e-run.yml
21+
secrets: inherit
22+
with:
23+
suite_name: "smoke"
24+
sha: ${{ github.event.pull_request.head.sha }}

.github/workflows/e2e-run.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: "E2E: Run tests"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
suite_name:
7+
description: 'Test suite name to run'
8+
default: 'regression'
9+
required: true
10+
type: string
11+
sha:
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: read
17+
checks: write
18+
statuses: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ github.token }}
28+
ref: ${{ inputs.sha }}
29+
30+
- name: Set up JDK
31+
uses: actions/setup-java@v3
32+
with:
33+
java-version: '17'
34+
distribution: 'zulu'
35+
cache: 'maven'
36+
37+
- name: Build with Maven
38+
id: build_app
39+
run: |
40+
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
41+
./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true
42+
43+
- name: Upload maven artifacts
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: artifacts
47+
path: ~/.m2/repository/io/kafbat/ui/**/*
48+
retention-days: 7
49+
50+
- name: Dump docker image
51+
run: |
52+
docker image save ghcr.io/kafbat/kafka-ui:latest > /tmp/image.tar
53+
54+
- name: Upload docker image
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: image
58+
path: /tmp/image.tar
59+
retention-days: 7
60+
61+
tests:
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
with:
69+
token: ${{ github.token }}
70+
ref: ${{ inputs.sha }}
71+
72+
- name: Set up JDK
73+
uses: actions/setup-java@v3
74+
with:
75+
java-version: '17'
76+
distribution: 'zulu'
77+
cache: 'maven'
78+
79+
- name: Download maven artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: artifacts
83+
path: ~/.m2/repository/io/kafbat/ui
84+
85+
- name: Download docker image
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: image
89+
path: /tmp
90+
91+
- name: Load Docker image
92+
run: |
93+
docker load --input /tmp/image.tar
94+
95+
- name: Cache Docker images.
96+
uses: ScribeMD/docker-cache@0.5.0
97+
with:
98+
key: docker-${{ runner.os }}-${{ hashFiles('./e2e-tests/selenoid/selenoid-ci.yaml', './documentation/compose/e2e-tests.yaml') }}
99+
100+
- name: Compose up
101+
id: compose_app
102+
# use the following command until #819 will be fixed # TODO recheck 819
103+
run: |
104+
mkdir -p ./e2e-tests/target/selenoid-results/video
105+
mkdir -p ./e2e-tests/target/selenoid-results/logs
106+
docker-compose -f ./e2e-tests/selenoid/selenoid-ci.yaml up -d
107+
docker-compose -f ./documentation/compose/e2e-tests.yaml up -d
108+
109+
- name: Dump Docker logs on failure
110+
if: failure()
111+
uses: jwalton/gh-docker-logs@v2.2.2
112+
113+
- name: Run test suite
114+
run: |
115+
./mvnw -B -ntp versions:set -DnewVersion=${{ inputs.sha }}
116+
./mvnw -B -V -ntp -Dsurefire.suiteXmlFiles='src/test/resources/${{ inputs.suite_name }}.xml' -f 'e2e-tests' test -Pprod
117+
118+
- name: Upload allure reports artifact
119+
if: '!cancelled()'
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: reports
123+
path: ./e2e-tests/target/allure-results
124+
retention-days: 7
125+
126+
reports:
127+
runs-on: ubuntu-latest
128+
needs: tests
129+
if: ${{ !cancelled() && github.repository == 'kafbat/kafka-ui' }}
130+
steps:
131+
- name: Download allure reports artifact
132+
uses: actions/download-artifact@v4
133+
with:
134+
name: reports
135+
path: ./e2e-tests/target/allure-results
136+
137+
- name: Generate Allure report
138+
uses: simple-elf/allure-report-action@v1.9
139+
id: allure-report
140+
with:
141+
allure_results: ./e2e-tests/target/allure-results
142+
gh_pages: allure-results
143+
allure_report: allure-report
144+
subfolder: allure-results
145+
report_url: "https://reports.kafbat.dev"
146+
147+
- name: Upload allure report to R2
148+
uses: ryand56/r2-upload-action@latest
149+
with:
150+
source-dir: allure-history/allure-results
151+
destination-dir: .
152+
r2-bucket: "reports"
153+
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
154+
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
155+
r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET_KEY }}
156+
157+
- name: Add allure link status check
158+
uses: Sibz/github-status-action@v1.1.6
159+
with:
160+
authToken: ${{secrets.GITHUB_TOKEN}}
161+
context: "Click Details button to view Allure report"
162+
state: "success"
163+
sha: ${{ inputs.sha }}
164+
target_url: https://reports.kafbat.dev/${{ github.run_number }}

.github/workflows/e2e-weekly.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "E2E: Weekly suite"
2+
on:
3+
schedule:
4+
- cron: '0 1 * * 1'
5+
6+
permissions:
7+
contents: read
8+
checks: write
9+
statuses: write
10+
11+
jobs:
12+
build-and-test:
13+
uses: ./.github/workflows/e2e-run.yml
14+
secrets: inherit
15+
with:
16+
suite_name: "sanity"
17+
sha: ${{ github.sha }}

.github/workflows/welcome-first-time-contributors.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,22 @@ jobs:
1818
with:
1919
repo-token: ${{ secrets.GITHUB_TOKEN }}
2020
issue-message: |
21-
Hello there ${{ github.actor }}! 👋
21+
Hi ${{ github.actor }}! 👋
2222
23-
Thank you and congratulations 🎉 for opening your very first issue in this project! 💖
23+
Welcome, and thank you for opening your first issue in the repo!
2424
25-
In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀
25+
Please wait for triaging by our maintainers.
26+
27+
As development is carried out in our spare time, you can support us by sponsoring our activities or even funding the development of specific issues.
28+
[Sponsorship link](https://github.com/kafbat)
29+
30+
If you plan to raise a PR for this issue, please take a look at our [contributing guide](https://ui.docs.kafbat.io/development/contributing).
2631
2732
pr-message: |
28-
Hello there ${{ github.actor }}! 👋
33+
Hi ${{ github.actor }}! 👋
34+
35+
Welcome, and thank you for opening your first PR in the repo!
2936
30-
Thank you and congrats 🎉 for opening your first PR on this project! ✨ 💖
37+
Please wait for triaging by our maintainers.
3138
32-
We will try to review it soon!
39+
Please take a look at our [contributing guide](https://ui.docs.kafbat.io/development/contributing).

api/src/main/java/io/kafbat/ui/KafkaUiApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.springframework.scheduling.annotation.EnableAsync;
99
import org.springframework.scheduling.annotation.EnableScheduling;
1010

11-
@SpringBootApplication(exclude = LdapAutoConfiguration.class)
11+
@SpringBootApplication
1212
@EnableScheduling
1313
@EnableAsync
1414
public class KafkaUiApplication {

api/src/main/java/io/kafbat/ui/config/ReadOnlyModeFilter.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.kafbat.ui.service.ClustersStorage;
66
import java.net.URLDecoder;
77
import java.nio.charset.StandardCharsets;
8+
import java.util.Set;
89
import java.util.regex.Pattern;
910
import lombok.RequiredArgsConstructor;
1011
import org.jetbrains.annotations.NotNull;
@@ -23,6 +24,10 @@ public class ReadOnlyModeFilter implements WebFilter {
2324
private static final Pattern CLUSTER_NAME_REGEX =
2425
Pattern.compile("/api/clusters/(?<clusterName>[^/]++)");
2526

27+
private static final Set<Pattern> SAFE_ENDPOINTS = Set.of(
28+
Pattern.compile("/api/clusters/[^/]+/topics/[^/]+/(smartfilters)$")
29+
);
30+
2631
private final ClustersStorage clustersStorage;
2732

2833
@NotNull
@@ -35,10 +40,12 @@ public Mono<Void> filter(ServerWebExchange exchange, @NotNull WebFilterChain cha
3540

3641
var path = exchange.getRequest().getPath().pathWithinApplication().value();
3742
var decodedPath = URLDecoder.decode(path, StandardCharsets.UTF_8);
43+
3844
var matcher = CLUSTER_NAME_REGEX.matcher(decodedPath);
3945
if (!matcher.find()) {
4046
return chain.filter(exchange);
4147
}
48+
4249
var clusterName = matcher.group("clusterName");
4350
var kafkaCluster = clustersStorage.getClusterByName(clusterName)
4451
.orElseThrow(
@@ -49,6 +56,15 @@ public Mono<Void> filter(ServerWebExchange exchange, @NotNull WebFilterChain cha
4956
return chain.filter(exchange);
5057
}
5158

59+
var isSafeEndpoint = SAFE_ENDPOINTS
60+
.stream()
61+
.parallel()
62+
.anyMatch(endpoint -> endpoint.matcher(decodedPath).matches());
63+
64+
if (isSafeEndpoint) {
65+
return chain.filter(exchange);
66+
}
67+
5268
return Mono.error(ReadOnlyModeException::new);
5369
}
5470
}

api/src/main/java/io/kafbat/ui/config/auth/LdapProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class LdapProperties {
2020

2121
@Value("${oauth2.ldap.activeDirectory:false}")
2222
private boolean isActiveDirectory;
23-
@Value("${oauth2.ldap.aсtiveDirectory.domain:@null}")
23+
@Value("${oauth2.ldap.activeDirectory.domain:@null}")
2424
private String activeDirectoryDomain;
2525

2626
}

0 commit comments

Comments
 (0)