Skip to content

Commit cbde03a

Browse files
Merge remote-tracking branch 'origin/release/current'
# Conflicts: # openbas-front/package.json # openbas-front/yarn.lock
2 parents d2ca34f + 19736c7 commit cbde03a

File tree

648 files changed

+27147
-9080
lines changed

Some content is hidden

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

648 files changed

+27147
-9080
lines changed

.drone.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ steps:
99
SPRING_DATASOURCE_URL: jdbc:postgresql://pgsql:5432/openbas
1010
MINIO_ENDPOINT: minio
1111
MINIO_PORT: 9000
12+
ENGINE_URL: http://elastic:9200
1213
commands:
1314
- mvn clean install -q -DskipTests
1415
- mvn spotless:check
@@ -18,7 +19,7 @@ steps:
1819
- mvn test -q
1920

2021
- name: frontend-tests
21-
image: node:22.14.0-alpine
22+
image: node:22.15.0-alpine
2223
volumes:
2324
- name: cache-node-frontend
2425
path: /drone/src/openbas-front/node_modules
@@ -40,6 +41,7 @@ steps:
4041
SPRING_DATASOURCE_PASSWORD: openbas
4142
MINIO_ENDPOINT: minio-e2e
4243
MINIO_PORT: 9000
44+
ENGINE_URL: http://elastic:9200
4345
MINIO_ACCESS_KEY: minioadmin
4446
MINIO_ACCESS_SECRET: minioadmin
4547
OPENBAS_ADMIN_EMAIL: [email protected]
@@ -66,7 +68,7 @@ steps:
6668
- frontend-tests
6769

6870
- name: frontend-e2e-tests
69-
image: node:22.14.0
71+
image: node:22.15.0
7072
volumes:
7173
- name: cache-node-frontend-e2e
7274
path: /drone/src/openbas-front/node_modules
@@ -81,6 +83,25 @@ steps:
8183
depends_on:
8284
- app-e2e
8385

86+
- name: frontend-api-types
87+
image: node:22.15.0
88+
volumes:
89+
- name: cache-node-frontend-api-types
90+
path: /drone/src/openbas-front/node_modules
91+
commands:
92+
- apt update
93+
- apt -y install netcat-traditional
94+
- while ! nc -z app-e2e 8080 ; do sleep 1 ; done
95+
- cd openbas-front
96+
- yarn install
97+
- API_URL=http://app-e2e:8080 yarn generate-types-from-api
98+
- |
99+
if git diff --name-only | grep -q './src/utils/api-types.d.ts'; then
100+
echo "⚠️ Forgot to generate types! Please run 'yarn run generate-types-from-api' before committing."; exit 1;
101+
fi
102+
depends_on:
103+
- app-e2e
104+
84105
- name: codecov
85106
image: robertstettner/drone-codecov
86107
settings:
@@ -166,6 +187,12 @@ services:
166187
POSTGRES_USER: openbas
167188
POSTGRES_PASSWORD: openbas
168189
POSTGRES_DB: openbas
190+
- name: elastic
191+
image: docker.elastic.co/elasticsearch/elasticsearch:8.18.0
192+
environment:
193+
discovery.type: single-node
194+
xpack.security.enabled: false
195+
ES_JAVA_OPTS: -Xms2g -Xmx2g
169196

170197
volumes:
171198
- name: cache-node-frontend

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Thus already a BIG THANK YOU upfront to you for choosing to help with your PR.
1010
*
1111
*
1212

13+
### Testing Instructions
14+
15+
1. Step-by-step how to test
16+
2. Environment or config notes
17+
1318
### Related issues
1419

1520
* Closes #ISSUE-NUMBER

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:22.14.0-alpine3.20 AS front-builder
1+
FROM node:22.15.0-alpine3.20 AS front-builder
22

33
WORKDIR /opt/openbas-build/openbas-front
44
COPY openbas-front/packages ./packages

openbas-api/pom.xml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515

1616
<properties>
1717
<bcpg-jdk18on.version>1.80</bcpg-jdk18on.version>
18-
<commons-collections4.version>4.4</commons-collections4.version>
18+
<commons-collections4.version>4.5.0</commons-collections4.version>
1919
<commons-email.version>1.5</commons-email.version>
2020
<opensaml.version>4.3.2</opensaml.version>
2121
<springdoc.version>2.6.0</springdoc.version>
2222
<springdoc-plugin.version>1.4</springdoc-plugin.version>
2323
<cron-utils.version>9.2.1</cron-utils.version>
24-
<apache-poi.version>5.4.0</apache-poi.version>
25-
<opentelemetry.version>1.48.0</opentelemetry.version>
26-
<opentelemetry-semconv.version>1.30.0</opentelemetry-semconv.version>
24+
<apache-poi.version>5.4.1</apache-poi.version>
25+
<opentelemetry.version>1.49.0</opentelemetry.version>
26+
<opentelemetry-semconv.version>1.32.0</opentelemetry-semconv.version>
27+
<elasticsearch.version>8.18.0</elasticsearch.version>
2728
</properties>
2829

2930
<profiles>
@@ -50,6 +51,11 @@
5051
<artifactId>openbas-framework</artifactId>
5152
<version>1.15.2</version>
5253
</dependency>
54+
<dependency>
55+
<groupId>co.elastic.clients</groupId>
56+
<artifactId>elasticsearch-java</artifactId>
57+
<version>${elasticsearch.version}</version>
58+
</dependency>
5359
<dependency>
5460
<groupId>com.rabbitmq</groupId>
5561
<artifactId>amqp-client</artifactId>
@@ -85,6 +91,15 @@
8591
<groupId>org.springframework.boot</groupId>
8692
<artifactId>spring-boot-starter-webflux</artifactId>
8793
</dependency>
94+
95+
<dependency>
96+
<groupId>org.springframework.boot</groupId>
97+
<artifactId>spring-boot-starter-cache</artifactId>
98+
</dependency>
99+
<dependency>
100+
<groupId>com.github.ben-manes.caffeine</groupId>
101+
<artifactId>caffeine</artifactId>
102+
</dependency>
88103
<dependency>
89104
<groupId>org.springframework.boot</groupId>
90105
<artifactId>spring-boot-configuration-processor</artifactId>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package io.openbas;
22

3+
import io.openbas.tools.FlywayMigrationValidator;
34
import org.springframework.boot.SpringApplication;
45
import org.springframework.boot.autoconfigure.SpringBootApplication;
56

67
@SpringBootApplication
78
public class App {
89

910
public static void main(String[] args) {
11+
FlywayMigrationValidator.validateFlywayMigrationNames();
1012
SpringApplication.run(App.class, args);
1113
}
1214
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.openbas.config;
2+
3+
import com.github.benmanes.caffeine.cache.Caffeine;
4+
import java.time.Duration;
5+
import org.springframework.cache.CacheManager;
6+
import org.springframework.cache.annotation.EnableCaching;
7+
import org.springframework.cache.caffeine.CaffeineCacheManager;
8+
import org.springframework.context.annotation.Bean;
9+
import org.springframework.context.annotation.Configuration;
10+
11+
@Configuration
12+
@EnableCaching
13+
public class CachingConfig {
14+
15+
@Bean
16+
public CacheManager cacheManager() {
17+
CaffeineCacheManager cacheManager = new CaffeineCacheManager("license");
18+
19+
cacheManager.setCaffeine(
20+
Caffeine.newBuilder().expireAfterWrite(Duration.ofDays(1)).maximumSize(100));
21+
22+
return cacheManager;
23+
}
24+
}

openbas-api/src/main/java/io/openbas/config/SessionHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public class SessionHelper {
77
public static final String ANONYMOUS_USER = "anonymousUser";
88

99
public static OpenBASPrincipal currentUser() {
10+
if (SecurityContextHolder.getContext().getAuthentication() == null) {
11+
return new OpenBASAnonymous();
12+
}
1013
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
1114
if (ANONYMOUS_USER.equals(principal)) {
1215
return new OpenBASAnonymous();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.openbas.config.cache;
2+
3+
import io.openbas.ee.Ee;
4+
import io.openbas.ee.License;
5+
import org.springframework.cache.annotation.CacheEvict;
6+
import org.springframework.cache.annotation.Cacheable;
7+
import org.springframework.stereotype.Service;
8+
9+
@Service
10+
public class LicenseCacheManager {
11+
private final Ee eeService;
12+
13+
public LicenseCacheManager(Ee eeService) {
14+
this.eeService = eeService;
15+
}
16+
17+
@Cacheable("license")
18+
public License getEnterpriseEditionInfo() {
19+
return eeService.getEnterpriseEditionInfo();
20+
}
21+
22+
@CacheEvict(value = "license", allEntries = true)
23+
public void refreshLicense() {
24+
eeService.getEnterpriseEditionInfo();
25+
}
26+
}

0 commit comments

Comments
 (0)