Compare commits

...

18 commits

Author SHA1 Message Date
201c448e8c deps: Update dependencies
Some checks failed
ci/woodpecker/push/oci-image-build/1 Pipeline is pending
ci/woodpecker/push/oci-image-build/2 Pipeline is pending
ci/woodpecker/push/oci-image-build/3 Pipeline is pending
ci/woodpecker/push/oci-image-build/4 Pipeline is pending
ci/woodpecker/push/oci-image-build/5 Pipeline is pending
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/cleanup unknown status
2024-03-10 17:14:42 +01:00
028c9e1c4b ci: Fix image-name to delete
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
ci/woodpecker/push/cleanup Pipeline was successful
2024-03-10 16:41:48 +01:00
9cd636d7cf ci: Enable pulling plugin image on each run 2024-03-10 16:41:42 +01:00
aff5ce5817 ci: Fix delete-tag image ref
Some checks failed
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
ci/woodpecker/push/cleanup Pipeline failed
2024-03-08 19:11:35 +01:00
168b257dd6 ci: Fix setup image arg to use pipeline cache
Some checks failed
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
ci/woodpecker/push/cleanup Pipeline failed
2024-03-08 18:01:09 +01:00
ad5bf5111e ci: Remove deprecated group option
Some checks failed
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline failed
ci/woodpecker/push/oci-image-build/2 Pipeline failed
ci/woodpecker/push/oci-image-build/3 Pipeline failed
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline failed
ci/woodpecker/push/cleanup unknown status
2024-03-02 23:14:56 +01:00
c86b4182a4 ci: Add image cache cleanup step after build 2024-03-02 23:08:47 +01:00
b521706127 ci: Try to fix setup-image tagging
Some checks failed
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline failed
2024-03-02 22:50:08 +01:00
d1638ad484 deps: Update dependencies 2024-03-02 22:02:08 +01:00
f29ec8f5c2 bot: Reduce ChatGPTResponse object
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
2024-03-02 16:09:53 +01:00
2abae09fa4 ci: Fix cache image tag 2024-03-02 16:00:09 +01:00
eaba43c51b monolith: Make App class final
Like the other modules :)
2024-03-02 15:58:16 +01:00
84aa5fdf3e web: Disable banner
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
2024-02-18 16:20:07 +01:00
81127ba780 ci: Fix cache build tag
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
2024-02-18 14:47:27 +01:00
dedbee2105 ci: Enable cache build regardles of branch
All checks were successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/oci-image-build/5 Pipeline was successful
2024-02-18 14:14:48 +01:00
92db958781 ci: Use build cache image
Some checks failed
ci/woodpecker/push/oci-image-build/5 Pipeline is pending
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/java/5 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-cache-build Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline failed
ci/woodpecker/push/oci-image-build/2 Pipeline failed
ci/woodpecker/push/oci-image-build/3 Pipeline failed
ci/woodpecker/push/oci-image-build/4 Pipeline failed
2024-02-18 14:06:28 +01:00
c1af92e895 ci: Add step to build a cache image 2024-02-18 14:05:45 +01:00
1b07762974 build: Change to support build cache image 2024-02-18 14:05:32 +01:00
9 changed files with 61 additions and 27 deletions

13
.woodpecker/cleanup.yml Normal file
View file

@ -0,0 +1,13 @@
depends_on:
- oci-image-build
steps:
delete-tag:
image: rg.fr-par.scw.cloud/hamburghammer/scaleway-delete-image-plugin
pull: true
settings:
token:
from_secret: docker_token
image-name: dchat/setup-image
tag: "${CI_PIPELINE_NUMBER}"
region: fr-par

View file

@ -12,16 +12,13 @@ variables:
steps:
compile:
image: *image
group: compile
commands:
- mvn --batch-mode --no-transfer-progress -pl ${MODULE} -am compile
test:
image: *image
group: test
commands:
- mvn --batch-mode --no-transfer-progress -pl ${MODULE} -am test
build:
image: *image
group: build
commands:
- mvn --batch-mode --no-transfer-progress -Dmaven.test.skip -pl ${MODULE} -am install

View file

@ -13,13 +13,11 @@ labels:
platform: linux/amd64
depends_on:
- java
- nodejs
- oci-image-cache-build
steps:
build-only:
image: woodpeckerci/plugin-docker-buildx:2.3.0
group: build
settings:
registry: rg.fr-par.scw.cloud/hamburghammer
username: nologin
@ -32,6 +30,8 @@ steps:
pull_image: false
platforms: ${PLATFORM}
dry-run: true
build_args:
- SETUP_IMAGE=rg.fr-par.scw.cloud/hamburghammer/dchat/setup-image:${CI_PIPELINE_NUMBER}
when:
- event: [push, manual]
branch:
@ -39,7 +39,6 @@ steps:
build:
image: woodpeckerci/plugin-docker-buildx:2.3.0
group: build
settings:
registry: rg.fr-par.scw.cloud/hamburghammer
username: nologin
@ -52,5 +51,7 @@ steps:
pull_image: false
platforms: ${PLATFORM}
auto_tag: true
build_args:
- SETUP_IMAGE=rg.fr-par.scw.cloud/hamburghammer/dchat/setup-image:${CI_PIPELINE_NUMBER}
when:
- branch: main

View file

@ -0,0 +1,26 @@
matrix:
PLATFORM:
# - linux/amd64
- linux/arm64
labels:
platform: linux/amd64
depends_on:
- java
- nodejs
steps:
build:
image: woodpeckerci/plugin-docker-buildx:2.3.0
settings:
registry: rg.fr-par.scw.cloud/hamburghammer
username: nologin
password:
from_secret: docker_token
dockerfile: Dockerfile
target: setup-image
repo: rg.fr-par.scw.cloud/hamburghammer/dchat/setup-image
tag: "${CI_PIPELINE_NUMBER}"
pull_image: false
platforms: ${PLATFORM}

View file

@ -1,14 +1,17 @@
# syntax=docker/dockerfile:1.4.0
ARG MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress -Dmaven.test.skip"
ARG SETUP_IMAGE=setup-image
# Copy all project files
FROM docker.io/maven:3.9-eclipse-temurin-21 AS setup
FROM docker.io/maven:3.9-eclipse-temurin-21 AS setup-image
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/root/.m2/ \
mvn ${MAVEN_CLI_OPTS} package
FROM ${SETUP_IMAGE} as setup
# Create final monolith
FROM docker.io/eclipse-temurin:21-jdk-jammy AS monolith
WORKDIR /app

View file

@ -6,24 +6,17 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public record ChatGPTResponse(String id,
String object,
long created,
String model,
Usage usage,
List<Choice> choices,
@JsonProperty("system_fingerprint") String systemFingerprint) {
public record ChatGPTResponse(Usage usage,
List<Choice> choices) {
@JsonIgnoreProperties(ignoreUnknown = true)
public record Usage(@JsonProperty("prompt_tokens") int promptTokens,
@JsonProperty("completion_tokens") int completionTokens,
@JsonProperty("total_tokens") int totalTokens) {
}
@JsonIgnoreProperties(ignoreUnknown = true)
public record Choice(Message message, @JsonProperty("finish_reason") String finishReason, int index) {
public record Choice(Message message) {
@JsonIgnoreProperties(ignoreUnknown = true)
public record Message(String role, String content) {
}
}
}

View file

@ -18,10 +18,10 @@ import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
public class App {
public final class App {
private static final Logger logger = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
public static void main(final String[] args) {
final String discordApiKey = System.getenv("DISCORD_API_KEY");
if (discordApiKey == null) {
logger.error("Missing environment variables: DISCORD_API_KEY");
@ -63,12 +63,12 @@ public class App {
}
}
private static void run(Runnable... apps) throws InterruptedException {
List<Callable<Void>> callableApps = Arrays.stream(apps).sequential().map(runnable -> (Callable<Void>) () -> {
private static void run(final Runnable... apps) throws InterruptedException {
final List<Callable<Void>> callableApps = Arrays.stream(apps).sequential().map(runnable -> (Callable<Void>) () -> {
runnable.run();
return null;
}).toList();
try (var executorService = Executors.newFixedThreadPool(apps.length)) {
try (final var executorService = Executors.newFixedThreadPool(apps.length)) {
executorService.invokeAll(callableApps);
}
}

View file

@ -61,7 +61,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.14</version>
<version>1.5.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
@ -73,7 +73,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.1</version>
<version>42.7.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
@ -99,7 +99,7 @@
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>6.0.1</version>
<version>6.1.3</version>
</dependency>
<dependency>
<groupId>org.javacord</groupId>

View file

@ -36,6 +36,7 @@ public final class WebAPI implements Runnable {
config.http.prefer405over404 = true; // return 405 instead of 404 if path is mapped to different HTTP method
config.http.defaultContentType = "application/json";
config.useVirtualThreads = true;
config.showJavalinBanner = false;
config.router.apiBuilder(() ->
path("api", () -> {
path("servers", () -> crud("configs/{id}", new ConfigCrudHandler(this.serverDBService)));