From 4e6a2d35002d2340d384c352f754e2db488c2cf9 Mon Sep 17 00:00:00 2001 From: Pierre Mauduit Date: Wed, 20 Mar 2024 13:58:01 +0100 Subject: [PATCH 1/3] build - adds a debian packaging maven profile This allow to generate a debian package using the following command: ``` % mvn clean package deb:package -PdebianPackage -pl gateway ``` at the root of the repository. Note: As opposed to what is done in georchestra/georchestra, we decided to drop the `git clone datadir`, as people generally set up their infra by doing a git clone by themselves of their datadir, so having a default configuration provided in `/etc/georchestra` is not necessary. Note2: the modification on the Java file is unrelated and is due to the maven formatter plugin. --- gateway/pom.xml | 92 +++++++++++++++++++ .../accounts/admin/AccountManager.java | 3 +- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/gateway/pom.xml b/gateway/pom.xml index d20c9fe8..a543fda1 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -360,5 +360,97 @@ + + debianPackage + + yyyyMMddHHmm + + + ${project.artifactId} + + + pl.project13.maven + git-commit-id-plugin + 4.9.10 + + + + revision + + + + + build + false + false + false + + true + + true + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + copy-deb-resources + process-resources + copy-resources + + true + ${project.build.directory}/deb + + + src/deb/resources + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 3.1.0 + + + set-project-packageversion + package + + run + + + true + + + + + + + + + + + net.sf.debian-maven + debian-maven-plugin + 1.0.6 + + georchestra-gateway + geOrchestra Gateway + ${project.packageVersion} + geOrchestra + PSC + psc@georchestra.org + true + + + + + diff --git a/gateway/src/main/java/org/georchestra/gateway/accounts/admin/AccountManager.java b/gateway/src/main/java/org/georchestra/gateway/accounts/admin/AccountManager.java index 6074c642..dee2e77a 100644 --- a/gateway/src/main/java/org/georchestra/gateway/accounts/admin/AccountManager.java +++ b/gateway/src/main/java/org/georchestra/gateway/accounts/admin/AccountManager.java @@ -38,7 +38,8 @@ public interface AccountManager { * @param mappedUser the user {@link ResolveGeorchestraUserGlobalFilter} * resolved by calling * {@link GeorchestraUserMapper#resolve(Authentication)} - * @return the stored version of the user if it exists, otherwise an empty Optional + * @return the stored version of the user if it exists, otherwise an empty + * Optional */ Optional find(GeorchestraUser mappedUser); From e38e1fce92773b3978d4e8cba58c21655adeb40f Mon Sep 17 00:00:00 2001 From: Pierre Mauduit Date: Wed, 20 Mar 2024 14:29:51 +0100 Subject: [PATCH 2/3] fix tests + maven fmt Following https://github.com/georchestra/georchestra/commit/48130785965dc52c7fe54aa3ce686acfb8ebe5f8 the matcher `contains` expects also testadmin to be member of the ROLE_IMPORT role. Using `hasItems` instead (and adding the missing role to the list). --- gateway/pom.xml | 16 ++++++++-------- .../admin/CreateAccountUserCustomizerIT.java | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/gateway/pom.xml b/gateway/pom.xml index a543fda1..53777875 100644 --- a/gateway/pom.xml +++ b/gateway/pom.xml @@ -362,9 +362,6 @@ debianPackage - - yyyyMMddHHmm - ${project.artifactId} @@ -398,7 +395,9 @@ copy-deb-resources process-resources - copy-resources + + copy-resources + true ${project.build.directory}/deb @@ -425,10 +424,8 @@ true - - + + @@ -451,6 +448,9 @@ + + yyyyMMddHHmm + diff --git a/gateway/src/test/java/org/georchestra/gateway/accounts/admin/CreateAccountUserCustomizerIT.java b/gateway/src/test/java/org/georchestra/gateway/accounts/admin/CreateAccountUserCustomizerIT.java index 74cd65b0..cf4583f1 100644 --- a/gateway/src/test/java/org/georchestra/gateway/accounts/admin/CreateAccountUserCustomizerIT.java +++ b/gateway/src/test/java/org/georchestra/gateway/accounts/admin/CreateAccountUserCustomizerIT.java @@ -147,9 +147,10 @@ private WebTestClient.RequestHeadersUriSpec prepareWebTestClientHeaders( .is2xxSuccessful()// .expectBody()// .jsonPath("$.GeorchestraUser").isNotEmpty()// - .jsonPath("$.GeorchestraUser.roles").value(Matchers.contains("ROLE_ADMINISTRATOR", // + .jsonPath("$.GeorchestraUser.roles").value(Matchers.hasItems("ROLE_ADMINISTRATOR", // "ROLE_SUPERUSER", // "ROLE_GN_ADMIN", // + "ROLE_IMPORT", // "ROLE_USER", // "ROLE_MAPSTORE_ADMIN", // "ROLE_EMAILPROXY")); From 3a29ee6ac08c772a8d1470877e65fac81a0b6725 Mon Sep 17 00:00:00 2001 From: Pierre Mauduit Date: Wed, 20 Mar 2024 15:17:26 +0100 Subject: [PATCH 3/3] adding a deb target to the Makefile --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 0b2a4d17..a931e3ef 100644 --- a/Makefile +++ b/Makefile @@ -12,3 +12,6 @@ docker: echo tagging georchestra/gateway:$${TAG} as georchestra/gateway:latest && \ docker tag georchestra/gateway:$${TAG} georchestra/gateway:latest && \ docker images|grep "georchestra/gateway"|grep latest + +deb: install + ./mvnw package deb:package -f gateway/ -PdebianPackage