From c69507d55345e353da319a139148e4bea2efb9c8 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:18:44 +0200 Subject: [PATCH 01/14] try docker @ ci. --- .drone.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 940a6dc..c895c4b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,6 @@ kind: pipeline type: docker name: default - steps: - name: test image: maven:3.8-openjdk-18-slim @@ -25,4 +24,10 @@ steps: - master event: exclude: - - pull_request + - pull_request + - name: build_docker_image + plugin: docker + commands: docker image build -f docker/Dockerfile . + when: + branch: + - feature/docker From 0d7f2169801af0ee5000ff8c3415abc972ed5424 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:19:20 +0200 Subject: [PATCH 02/14] fix ci spec --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index c895c4b..b8706e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,8 @@ steps: - pull_request - name: build_docker_image plugin: docker - commands: docker image build -f docker/Dockerfile . + commands: + - docker image build -f docker/Dockerfile . when: branch: - feature/docker From f8ba19f2f061ce8aa24390a791a401d3c93e7821 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:20:10 +0200 Subject: [PATCH 03/14] fix ci spec again --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b8706e9..f9d83bf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: exclude: - pull_request - name: build_docker_image - plugin: docker + image: plugins/docker commands: - docker image build -f docker/Dockerfile . when: From 852a19a49cfc4d06b3ee18f7aeac6ca02f215d08 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:33:02 +0200 Subject: [PATCH 04/14] fix docker step --- .drone.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index f9d83bf..08af83f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,8 +27,18 @@ steps: - pull_request - name: build_docker_image image: plugins/docker - commands: - - docker image build -f docker/Dockerfile . + settings: + registry: gittr.ch + username: manuel + password: + from_secret: docker-token + repo: java/labyrinth-server + tags: + - latest + dockerfile: docker/Dockerfile + dry_run: true + auto_tag: true + auto_tag_suffix: "-ci" when: branch: - feature/docker From a72767097ecf81015f3f68ec0e0053ada24cb8d2 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:35:41 +0200 Subject: [PATCH 05/14] no dry_run for docker --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 08af83f..5cb0d3a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,7 +36,6 @@ steps: tags: - latest dockerfile: docker/Dockerfile - dry_run: true auto_tag: true auto_tag_suffix: "-ci" when: From 41c5ad568c9f6560a92e623f2baf0e878d21c1fc Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:42:04 +0200 Subject: [PATCH 06/14] try the build. and debug for debugging. --- .drone.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5cb0d3a..c7626d3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,16 +28,18 @@ steps: - name: build_docker_image image: plugins/docker settings: - registry: gittr.ch + registry: gittr.ch/java/labyrinth username: manuel password: from_secret: docker-token - repo: java/labyrinth-server + repo: java/labyrinth tags: - latest dockerfile: docker/Dockerfile auto_tag: true auto_tag_suffix: "-ci" + debug: true + launch_debug: true when: branch: - feature/docker From e674b34b8565bffac73e7ca0ee1079d30fbea714 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:43:26 +0200 Subject: [PATCH 07/14] no auto-tag --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index c7626d3..ef26aaf 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,8 +36,8 @@ steps: tags: - latest dockerfile: docker/Dockerfile - auto_tag: true - auto_tag_suffix: "-ci" + # auto_tag: true + # auto_tag_suffix: "-ci" debug: true launch_debug: true when: From c5e2ea0b9eb30227ebce3d8ee00486fbf1bc4dc7 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:46:07 +0200 Subject: [PATCH 08/14] change registry --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index ef26aaf..fb4eef8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: branch: include: - master - - feature/* + # - feature/* - name: deploy image: maven:3.8-openjdk-18-slim environment: @@ -28,7 +28,7 @@ steps: - name: build_docker_image image: plugins/docker settings: - registry: gittr.ch/java/labyrinth + registry: gittr.ch username: manuel password: from_secret: docker-token From 21585aeed0ad3264ff5482396ff65597d691527e Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:47:33 +0200 Subject: [PATCH 09/14] fix build spec --- .drone.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fb4eef8..551b612 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,10 +2,18 @@ kind: pipeline type: docker name: default steps: - - name: test + - name: build image: maven:3.8-openjdk-18-slim commands: - mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + when: + branch: + include: + - master + - feature/* + - name: test + image: maven:3.8-openjdk-18-slim + commands: - mvn test -B when: branch: From ddcf68ff4b498d1911a65e35cd75cdf16a31e2a6 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 10:50:52 +0200 Subject: [PATCH 10/14] change repo? --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 551b612..abeacfb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -40,7 +40,7 @@ steps: username: manuel password: from_secret: docker-token - repo: java/labyrinth + repo: gittr.ch/java/labyrinth tags: - latest dockerfile: docker/Dockerfile From 5192cfcd8649eb27b5f33cb1091066abf45097ac Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 31 Mar 2023 11:02:09 +0200 Subject: [PATCH 11/14] additional tag --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index abeacfb..021f006 100644 --- a/.drone.yml +++ b/.drone.yml @@ -43,6 +43,7 @@ steps: repo: gittr.ch/java/labyrinth tags: - latest + - ${DRONE_SEMVER} dockerfile: docker/Dockerfile # auto_tag: true # auto_tag_suffix: "-ci" From ff047efd852ae5fb058b403c93e7ad5abd4e2faa Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 1 Apr 2023 00:21:20 +0200 Subject: [PATCH 12/14] java 17 --- docker/Dockerfile | 2 +- pom.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index abccd12..8c0219c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11 +FROM openjdk:17-slim COPY target/labyrinth-server-*.jar /app/app.jar diff --git a/pom.xml b/pom.xml index 3518f8b..ecd2143 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,8 @@ 1.4.6 1.18.26 2.0.5 + 17 + 17 From 305c26c21524264c4a0cc4437d17d01d873d712b Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 1 Apr 2023 00:21:38 +0200 Subject: [PATCH 13/14] show error, don't crash --- .../java/ch/fritteli/labyrinth/server/LabyrinthServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java b/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java index 689d9bc..aab20f6 100644 --- a/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java +++ b/src/main/java/ch/fritteli/labyrinth/server/LabyrinthServer.java @@ -105,15 +105,15 @@ public class LabyrinthServer { exchange.sendResponseHeaders(302, -1); return; } - final Labyrinth labyrinth = new Labyrinth(width, height, id); final byte[] render; try { + final Labyrinth labyrinth = new Labyrinth(width, height, id); render = output.render(labyrinth); } catch (Exception e) { responseHeaders.add("Content-type", "text/plain; charset=UTF-8"); exchange.sendResponseHeaders(500, 0); final OutputStream responseBody = exchange.getResponseBody(); - responseBody.write(("Error: " + e).getBytes(StandardCharsets.UTF_8)); + responseBody.write(("Error: " + e.getMessage()).getBytes(StandardCharsets.UTF_8)); responseBody.flush(); return; } From ec934134f4373d2c4f2fcf7f407afde54fef31f6 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 1 Apr 2023 00:22:31 +0200 Subject: [PATCH 14/14] try building tag release on git tag. --- .drone.yml | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 021f006..d8c9dcb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,7 +19,7 @@ steps: branch: include: - master - # - feature/* + - feature/* - name: deploy image: maven:3.8-openjdk-18-slim environment: @@ -43,12 +43,29 @@ steps: repo: gittr.ch/java/labyrinth tags: - latest - - ${DRONE_SEMVER} dockerfile: docker/Dockerfile - # auto_tag: true - # auto_tag_suffix: "-ci" - debug: true - launch_debug: true when: branch: - - feature/docker + - master + event: + exclude: + - pull_request + - tag + - name: build_docker_image_release + image: plugins/docker + settings: + registry: gittr.ch + username: manuel + password: + from_secret: docker-token + repo: gittr.ch/java/labyrinth + tags: + - latest + - ${DRONE_TAG} + dockerfile: docker/Dockerfile + when: + branch: + - master + event: + include: + - tag