From 6d75482bcaab50fbf9eb233bda55094daddc5697 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Sat, 2 Mar 2024 19:09:08 +0100 Subject: [PATCH 1/8] migrate: auto-migrate --- .gitignore | 20 ++++ Jenkinsfile | 48 +++++++-- plugin/build.xml => build.xml | 0 module-base/pom.xml | 10 ++ .../goobi/plugins/Messages/ErrorMessage.java | 0 .../plugins/Messages/UrlListMessage.java | 0 .../plugins/Messages/UrnCreationMessage.java | 0 .../UrnCreationSuccessfulMessage.java | 0 .../Messages/UrnSuggestionMessage.java | 0 .../CreateResponseHandler.java | 0 .../ResponseHandler/PatchResponseHandler.java | 0 .../SuggestionResponseHandler.java | 0 .../ResponseHandler/UrnResponseHandler.java | 0 .../java/de/intranda/goobi/plugins/Urn.java | 0 .../goobi/plugins/UrnDatabaseException.java | 0 .../goobi/plugins/UrnGenerationMethod.java | 0 .../intranda/goobi/plugins/UrnGenerator.java | 0 .../intranda/goobi/plugins/UrnRestClient.java | 0 .../intranda/goobi/plugins/UrnStepPlugin.java | 0 .../goobi/plugins/UrnGeneratorTest.java | 0 .../intranda/goobi/plugins/UrnPluginTest.java | 0 .../src/test/resources}/resources/log4j2.xml | 0 plugin/.classpath | 39 ------- plugin/.gitignore | 3 - plugin/.project | 28 ----- .../org.eclipse.core.resources.prefs | 2 - plugin/.settings/org.eclipse.jdt.core.prefs | 16 --- plugin/.settings/org.eclipse.m2e.core.prefs | 4 - plugin/module-main/.gitignore | 3 - plugin/module-main/pom.xml | 100 ------------------ plugin/pom.xml | 46 -------- plugin/src/test/resources/.gitignore | 1 - ...ep_urn.xml => plugin_intranda_step_urn.xml | 0 pom.xml | 28 +++++ 34 files changed, 97 insertions(+), 251 deletions(-) create mode 100644 .gitignore rename plugin/build.xml => build.xml (100%) create mode 100644 module-base/pom.xml rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Messages/ErrorMessage.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Messages/UrlListMessage.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationMessage.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationSuccessfulMessage.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Messages/UrnSuggestionMessage.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/ResponseHandler/CreateResponseHandler.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/ResponseHandler/PatchResponseHandler.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/ResponseHandler/SuggestionResponseHandler.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/ResponseHandler/UrnResponseHandler.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/Urn.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/UrnDatabaseException.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/UrnGenerationMethod.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/UrnGenerator.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/UrnRestClient.java (100%) rename {plugin => module-base}/src/main/java/de/intranda/goobi/plugins/UrnStepPlugin.java (100%) rename {plugin => module-base}/src/test/java/de/intranda/goobi/plugins/UrnGeneratorTest.java (100%) rename {plugin => module-base}/src/test/java/de/intranda/goobi/plugins/UrnPluginTest.java (100%) rename {plugin/src/test => module-base/src/test/resources}/resources/log4j2.xml (100%) delete mode 100644 plugin/.classpath delete mode 100644 plugin/.gitignore delete mode 100644 plugin/.project delete mode 100644 plugin/.settings/org.eclipse.core.resources.prefs delete mode 100644 plugin/.settings/org.eclipse.jdt.core.prefs delete mode 100644 plugin/.settings/org.eclipse.m2e.core.prefs delete mode 100644 plugin/module-main/.gitignore delete mode 100644 plugin/module-main/pom.xml delete mode 100644 plugin/pom.xml delete mode 100644 plugin/src/test/resources/.gitignore rename plugin/plugin_intranda_step_urn.xml => plugin_intranda_step_urn.xml (100%) create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f88813 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ + +# Junk files +*~ +.DS_Store + +# Build +target/ +bin/ +build/ +node_modules/ + +# Eclipse +.project +.classpath +.settings/ + +# IntelliJ IDEA +.idea +*.iml + diff --git a/Jenkinsfile b/Jenkinsfile index 44df4ed..1d5c15f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,13 @@ + pipeline { agent { docker { - image 'maven:3-jdk-11' - args '-v $HOME/.m2:/var/maven/.m2:z -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2' + /* using a custom build image with a defined home directory for UID 1000 among other things */ + image 'nexus.intranda.com:4443/maven:3.9.3-eclipse-temurin-17' + registryUrl 'https://nexus.intranda.com:4443' + registryCredentialsId 'jenkins-docker' + args '-v $HOME/.m2:/var/maven/.m2:z -v $HOME/.config:/var/maven/.config -v $HOME/.sonar:/var/maven/.sonar -u 1000 -ti -e _JAVA_OPTIONS=-Duser.home=/var/maven -e MAVEN_CONFIG=/var/maven/.m2' } } @@ -11,24 +15,52 @@ pipeline { buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '15', daysToKeepStr: '90', numToKeepStr: '') } - - stages { stage('prepare') { steps { - sh 'git clean -fdx' + sh 'git reset --hard HEAD && git clean -fdx' } } stage('build') { steps { - sh 'mvn -f plugin/pom.xml package' + sh 'mvn clean verify -U' recordIssues enabledForFailure: true, aggregatingResults: true, tools: [java(), javaDoc()] } } + + stage('sonarcloud') { + when { + anyOf { + branch 'master' + branch 'sonar_*' + } + } + steps { + withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) { + sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U' + } + } + } + } - + post { + always { + junit "**/target/surefire-reports/*.xml" + step([ + $class : 'JacocoPublisher', + execPattern : '**/target/jacoco.exec', + classPattern : '**/target/classes/', + sourcePattern : '**/src/main/java', + exclusionPattern : '**/*Test.class' + ]) + recordIssues ( + enabledForFailure: true, aggregatingResults: false, + tools: [checkStyle(pattern: 'target/checkstyle-result.xml', reportEncoding: 'UTF-8')] + ) + dependencyCheckPublisher pattern: 'target/dependency-check-report.xml' + } success { archiveArtifacts artifacts: '**/target/*.jar, */plugin_*.xml, plugin_*.xml', fingerprint: true, onlyIfSuccessful: true } @@ -42,5 +74,3 @@ pipeline { } } } - -/* vim: set ts=2 sw=2 tw=120 et :*/ \ No newline at end of file diff --git a/plugin/build.xml b/build.xml similarity index 100% rename from plugin/build.xml rename to build.xml diff --git a/module-base/pom.xml b/module-base/pom.xml new file mode 100644 index 0000000..d444822 --- /dev/null +++ b/module-base/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + io.goobi.workflow.plugin + plugin-step-urn + 24.03-SNAPSHOT + + plugin-step-urn-base + jar + \ No newline at end of file diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Messages/ErrorMessage.java b/module-base/src/main/java/de/intranda/goobi/plugins/Messages/ErrorMessage.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Messages/ErrorMessage.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Messages/ErrorMessage.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrlListMessage.java b/module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrlListMessage.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrlListMessage.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrlListMessage.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationMessage.java b/module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationMessage.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationMessage.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationMessage.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationSuccessfulMessage.java b/module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationSuccessfulMessage.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationSuccessfulMessage.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnCreationSuccessfulMessage.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnSuggestionMessage.java b/module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnSuggestionMessage.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Messages/UrnSuggestionMessage.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Messages/UrnSuggestionMessage.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/CreateResponseHandler.java b/module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/CreateResponseHandler.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/CreateResponseHandler.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/CreateResponseHandler.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/PatchResponseHandler.java b/module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/PatchResponseHandler.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/PatchResponseHandler.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/PatchResponseHandler.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/SuggestionResponseHandler.java b/module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/SuggestionResponseHandler.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/SuggestionResponseHandler.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/SuggestionResponseHandler.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/UrnResponseHandler.java b/module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/UrnResponseHandler.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/ResponseHandler/UrnResponseHandler.java rename to module-base/src/main/java/de/intranda/goobi/plugins/ResponseHandler/UrnResponseHandler.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/Urn.java b/module-base/src/main/java/de/intranda/goobi/plugins/Urn.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/Urn.java rename to module-base/src/main/java/de/intranda/goobi/plugins/Urn.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/UrnDatabaseException.java b/module-base/src/main/java/de/intranda/goobi/plugins/UrnDatabaseException.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/UrnDatabaseException.java rename to module-base/src/main/java/de/intranda/goobi/plugins/UrnDatabaseException.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/UrnGenerationMethod.java b/module-base/src/main/java/de/intranda/goobi/plugins/UrnGenerationMethod.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/UrnGenerationMethod.java rename to module-base/src/main/java/de/intranda/goobi/plugins/UrnGenerationMethod.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/UrnGenerator.java b/module-base/src/main/java/de/intranda/goobi/plugins/UrnGenerator.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/UrnGenerator.java rename to module-base/src/main/java/de/intranda/goobi/plugins/UrnGenerator.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/UrnRestClient.java b/module-base/src/main/java/de/intranda/goobi/plugins/UrnRestClient.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/UrnRestClient.java rename to module-base/src/main/java/de/intranda/goobi/plugins/UrnRestClient.java diff --git a/plugin/src/main/java/de/intranda/goobi/plugins/UrnStepPlugin.java b/module-base/src/main/java/de/intranda/goobi/plugins/UrnStepPlugin.java similarity index 100% rename from plugin/src/main/java/de/intranda/goobi/plugins/UrnStepPlugin.java rename to module-base/src/main/java/de/intranda/goobi/plugins/UrnStepPlugin.java diff --git a/plugin/src/test/java/de/intranda/goobi/plugins/UrnGeneratorTest.java b/module-base/src/test/java/de/intranda/goobi/plugins/UrnGeneratorTest.java similarity index 100% rename from plugin/src/test/java/de/intranda/goobi/plugins/UrnGeneratorTest.java rename to module-base/src/test/java/de/intranda/goobi/plugins/UrnGeneratorTest.java diff --git a/plugin/src/test/java/de/intranda/goobi/plugins/UrnPluginTest.java b/module-base/src/test/java/de/intranda/goobi/plugins/UrnPluginTest.java similarity index 100% rename from plugin/src/test/java/de/intranda/goobi/plugins/UrnPluginTest.java rename to module-base/src/test/java/de/intranda/goobi/plugins/UrnPluginTest.java diff --git a/plugin/src/test/resources/log4j2.xml b/module-base/src/test/resources/resources/log4j2.xml similarity index 100% rename from plugin/src/test/resources/log4j2.xml rename to module-base/src/test/resources/resources/log4j2.xml diff --git a/plugin/.classpath b/plugin/.classpath deleted file mode 100644 index f9d3200..0000000 --- a/plugin/.classpath +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugin/.gitignore b/plugin/.gitignore deleted file mode 100644 index f62f4e4..0000000 --- a/plugin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/bin/ -/target/ -.DS_Store diff --git a/plugin/.project b/plugin/.project deleted file mode 100644 index 65fed71..0000000 --- a/plugin/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - goobi-plugin-step-urn - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.zeroturnaround.eclipse.rebelXmlBuilder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - - diff --git a/plugin/.settings/org.eclipse.core.resources.prefs b/plugin/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/plugin/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/plugin/.settings/org.eclipse.jdt.core.prefs b/plugin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3a0745f..0000000 --- a/plugin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,16 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugin/.settings/org.eclipse.m2e.core.prefs b/plugin/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/plugin/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/plugin/module-main/.gitignore b/plugin/module-main/.gitignore deleted file mode 100644 index 7c9106d..0000000 --- a/plugin/module-main/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target/ -/bin/ -.DS_Store diff --git a/plugin/module-main/pom.xml b/plugin/module-main/pom.xml deleted file mode 100644 index ab759d1..0000000 --- a/plugin/module-main/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ - - 4.0.0 - de.intranda.goobi.plugins.step - urn-main - 24.02 - - plugin_intranda_step_urn - /opt/digiverso/goobi/plugins/step/ - - - de.intranda.goobi.plugins.step - urn - 24.02 - - - ${jar.name} - ${project.basedir}/../src/main/java - ${project.basedir}/../src/test/java - - - maven-compiler-plugin - 3.7.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.1 - - false - - - - pl.project13.maven - git-commit-id-plugin - 2.2.1 - - - - revision - - - - - flat - - true - - - - - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - - validate - - create - - - - - 10 - false - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - ${maven.build.timestamp} - - - - Versions - - ${project.version} - ${buildNumber} - ${scmBranch} - ${goobi.version} - - - - - - - - - - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-step-urn.git - scm:git:ssh://git@gitea.intranda.com:goobi-workflow/goobi-plugin-step-urn.git - - diff --git a/plugin/pom.xml b/plugin/pom.xml deleted file mode 100644 index 839640a..0000000 --- a/plugin/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - de.intranda.goobi.plugins.step - urn - 24.02 - pom - - 24.02 - UTF-8 - - - - intranda-releases - https://nexus.intranda.com/repository/maven-releases - - - - - intranda-public - https://nexus.intranda.com/repository/maven-public - - - - module-main - - - - de.intranda.goobi.workflow - goobi-core-jar - ${goobi.version} - - - org.projectlombok - lombok - 1.18.6 - provided - - - - junit - junit - 4.12 - test - - - diff --git a/plugin/src/test/resources/.gitignore b/plugin/src/test/resources/.gitignore deleted file mode 100644 index 496ee2c..0000000 --- a/plugin/src/test/resources/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store \ No newline at end of file diff --git a/plugin/plugin_intranda_step_urn.xml b/plugin_intranda_step_urn.xml similarity index 100% rename from plugin/plugin_intranda_step_urn.xml rename to plugin_intranda_step_urn.xml diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6019411 --- /dev/null +++ b/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + + io.goobi.workflow + workflow-base + 24.03-SNAPSHOT + + io.goobi.workflow.plugin + plugin-step-urn + pom + + module-base + + + + intranda-public + https://nexus.intranda.com/repository/maven-public + + + + + io.goobi.workflow + workflow-core + ${project.version} + classes + + + \ No newline at end of file From c08659a46486e6e0ef3c351b473bdad0b1efebb5 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Mon, 4 Mar 2024 09:02:26 +0100 Subject: [PATCH 2/8] pom.xml: fix relativePath reference in parent --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 6019411..5b1037f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,6 +4,7 @@ io.goobi.workflow workflow-base 24.03-SNAPSHOT + io.goobi.workflow.plugin plugin-step-urn From 5bb89d78d9fc295e8bb5cee2b729ee130fcb39b6 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Thu, 21 Mar 2024 14:43:01 +0100 Subject: [PATCH 3/8] Jenkinsfile: deploy lib module to nexus if present --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1d5c15f..7a92667 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,6 +43,21 @@ pipeline { } } + stage('deploy-libs') { + when { + anyOf { + branch 'master' + branch 'develop' + } + } + steps { + script { + if (fileExists('module-lib/pom.xml')) { + sh 'mvn -f module-lib/pom.xml deploy' + } + } + } + } } post { From 33702cde481ad03ae42ffae22adf157f176c947f Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Thu, 21 Mar 2024 15:16:54 +0100 Subject: [PATCH 4/8] Jenkinsfile: also deploy missing plugin parent pom and adapt to new artifacts path --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a92667..37bbe3a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,6 +53,7 @@ pipeline { steps { script { if (fileExists('module-lib/pom.xml')) { + sh 'mvn -N deploy' sh 'mvn -f module-lib/pom.xml deploy' } } @@ -77,7 +78,7 @@ pipeline { dependencyCheckPublisher pattern: 'target/dependency-check-report.xml' } success { - archiveArtifacts artifacts: '**/target/*.jar, */plugin_*.xml, plugin_*.xml', fingerprint: true, onlyIfSuccessful: true + archiveArtifacts artifacts: '**/target/*.jar, install/*', fingerprint: true, onlyIfSuccessful: true } changed { emailext( From 4cb1fddde41eb90cf0c77fc29157dcfe32c98254 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Mon, 15 Apr 2024 14:44:31 +0200 Subject: [PATCH 5/8] release: fix Jenkinsfile and GitHub actions, move install artifacts --- .github/workflows/develop-build.yml | 48 ++++++++++++++ .github/workflows/release-build.yml | 48 ++++++++++++++ .github/workflows/release.yml | 62 ------------------- Jenkinsfile | 23 ++++++- .../plugin_intranda_step_urn.xml | 0 5 files changed, 116 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/develop-build.yml create mode 100644 .github/workflows/release-build.yml delete mode 100644 .github/workflows/release.yml rename plugin_intranda_step_urn.xml => install/plugin_intranda_step_urn.xml (100%) diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml new file mode 100644 index 0000000..43a0c52 --- /dev/null +++ b/.github/workflows/develop-build.yml @@ -0,0 +1,48 @@ +name: Publish Development Build + +permissions: + contents: write + +on: + push: + branches: + - 'develop' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: true + files: | + **/target/*.jar + install/* + \ No newline at end of file diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..9e8a022 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,48 @@ +name: Publish Release Build + +permissions: + contents: write + +on: + push: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: false + files: | + **/target/*.jar + install/* + \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f233371..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build and upload to release - -on: - push: - branch: - - 'master' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Check out source code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn package --file plugin/pom.xml -DskipTests - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" - - name: Create tag name from date - id: tagdate - run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tagdate.outputs.tagdate }} - release_name: ${{ steps.date.outputs.date }} - draft: false - prerelease: false - - name: Upload main asset - id: upload-main-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: plugin/module-main/target/plugin_intranda_step_urn.jar - asset_name: plugin_intranda_step_urn.jar - asset_content_type: application/jar - - name: Upload Config asset - id: upload-config-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: plugin/plugin_intranda_step_urn.xml - asset_name: plugin_intranda_step_urn.xml - asset_content_type: text/xml \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 37bbe3a..4d103f4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,16 +43,33 @@ pipeline { } } - stage('deploy-libs') { + stage('deploy-snapshot-libs') { when { anyOf { - branch 'master' branch 'develop' } } steps { script { if (fileExists('module-lib/pom.xml')) { + sh 'cat pom.xml | grep "SNAPSHOT"' + sh 'mvn -N deploy' + sh 'mvn -f module-lib/pom.xml deploy' + } + } + } + } + + stage('deploy-release-libs') { + when { + anyOf { + branch 'master' + } + } + steps { + script { + if (fileExists('module-lib/pom.xml')) { + sh 'cat pom.xml | grep "SNAPSHOT" || true' sh 'mvn -N deploy' sh 'mvn -f module-lib/pom.xml deploy' } @@ -63,7 +80,7 @@ pipeline { post { always { - junit "**/target/surefire-reports/*.xml" + junit allowEmptyResults: true, testResults: "**/target/surefire-reports/*.xml" step([ $class : 'JacocoPublisher', execPattern : '**/target/jacoco.exec', diff --git a/plugin_intranda_step_urn.xml b/install/plugin_intranda_step_urn.xml similarity index 100% rename from plugin_intranda_step_urn.xml rename to install/plugin_intranda_step_urn.xml From 7f0eb796cd982f1324b62382eccdc8c3685b3840 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Fri, 3 May 2024 10:18:58 +0200 Subject: [PATCH 6/8] ci: update to latest CI scripts --- .github/workflows/develop-build.yml | 67 ++++++++++++++------------- .github/workflows/release-build.yml | 71 ++++++++++++++--------------- Jenkinsfile | 53 +++++++++++++-------- 3 files changed, 100 insertions(+), 91 deletions(-) diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml index 43a0c52..d9c62d8 100644 --- a/.github/workflows/develop-build.yml +++ b/.github/workflows/develop-build.yml @@ -12,37 +12,36 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Check out source code - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn clean verify -U - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" - - name: Create tag name from date - id: tagdate - run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" - - name: Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - name: ${{ steps.date.outputs.date }} - tag_name: ${{ steps.tagdate.outputs.tagdate }} - generate_release_notes: true - draft: false - prerelease: true - files: | - **/target/*.jar - install/* - \ No newline at end of file + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U -P snapshot-build + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" + - name: Create tag name from date + id: tagdate + run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.date.outputs.date }} + tag_name: ${{ steps.tagdate.outputs.tagdate }} + generate_release_notes: true + draft: false + prerelease: true + files: | + **/target/*.war + install/* diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 9e8a022..2ff7685 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -1,48 +1,45 @@ -name: Publish Release Build +name: Publish Development Build + +permissions: + contents: write + +name: Publish Development Build permissions: contents: write on: push: - branches: - - 'master' + tags: + - 'v*' jobs: build: runs-on: ubuntu-latest steps: - - name: Check out source code - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Set up Maven cache - uses: actions/cache@v1 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Build with Maven - run: mvn clean verify -U - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')" - - name: Create tag name from date - id: tagdate - run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')" - - name: Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - name: ${{ steps.date.outputs.date }} - tag_name: ${{ steps.tagdate.outputs.tagdate }} - generate_release_notes: true - draft: false - prerelease: false - files: | - **/target/*.jar - install/* - \ No newline at end of file + - name: Check out source code + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Set up Maven cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Build with Maven + run: mvn clean verify -U -P release-build + - name: Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + name: Release ${{ github.ref_name }} + generate_release_notes: true + draft: false + prerelease: false + files: | + **/target/*.war + install/* diff --git a/Jenkinsfile b/Jenkinsfile index 4d103f4..d2f4b4b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,54 +22,67 @@ pipeline { } } - stage('build') { + stage('build-snapshot') { + when { + not { + anyOf { + branch 'master' + branch 'release_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } + } + } + } steps { - sh 'mvn clean verify -U' - recordIssues enabledForFailure: true, aggregatingResults: true, tools: [java(), javaDoc()] + sh 'mvn clean verify -U -P snapshot-build' } } - - stage('sonarcloud') { + stage('build-release') { when { anyOf { branch 'master' - branch 'sonar_*' + branch 'release_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } } } steps { - withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) { - sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U' - } + sh 'mvn clean verify -U -P release-build' } } - - stage('deploy-snapshot-libs') { + stage('sonarcloud') { when { anyOf { - branch 'develop' + branch 'master' + branch 'release_*' + branch 'sonar_*' + allOf { + branch 'PR-*' + expression { env.CHANGE_BRANCH.startsWith("release_") } + } } } steps { - script { - if (fileExists('module-lib/pom.xml')) { - sh 'cat pom.xml | grep "SNAPSHOT"' - sh 'mvn -N deploy' - sh 'mvn -f module-lib/pom.xml deploy' - } + withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) { + sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U' } } } - stage('deploy-release-libs') { + stage('deploy-libs') { when { anyOf { branch 'master' + branch 'develop' } } steps { script { if (fileExists('module-lib/pom.xml')) { - sh 'cat pom.xml | grep "SNAPSHOT" || true' sh 'mvn -N deploy' sh 'mvn -f module-lib/pom.xml deploy' } From d70f5ca2b776dd206bb9acec7fc1e26e81abd530 Mon Sep 17 00:00:00 2001 From: Dominick Leppich Date: Fri, 3 May 2024 13:18:26 +0200 Subject: [PATCH 7/8] ci: update to latest CI scripts --- .github/workflows/develop-build.yml | 2 +- .github/workflows/release-build.yml | 9 ++------- Jenkinsfile | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/develop-build.yml b/.github/workflows/develop-build.yml index d9c62d8..78664d9 100644 --- a/.github/workflows/develop-build.yml +++ b/.github/workflows/develop-build.yml @@ -43,5 +43,5 @@ jobs: draft: false prerelease: true files: | - **/target/*.war + **/target/*.jar install/* diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 2ff7685..e3a9552 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -1,9 +1,4 @@ -name: Publish Development Build - -permissions: - contents: write - -name: Publish Development Build +name: Publish Release Build permissions: contents: write @@ -41,5 +36,5 @@ jobs: draft: false prerelease: false files: | - **/target/*.war + **/target/*.jar install/* diff --git a/Jenkinsfile b/Jenkinsfile index d2f4b4b..13cb478 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,6 @@ pipeline { sh 'git reset --hard HEAD && git clean -fdx' } } - stage('build-snapshot') { when { not { @@ -72,7 +71,6 @@ pipeline { } } } - stage('deploy-libs') { when { anyOf { @@ -89,6 +87,27 @@ pipeline { } } } + stage('tag release') { + when { branch 'master' } + steps { + withCredentials([gitUsernamePassword(credentialsId: '93f7e7d3-8f74-4744-a785-518fc4d55314', + gitToolName: 'git-tool')]) { + sh '''#!/bin/bash -xe + projectversion=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout) + if [ $? != 0 ] + then + exit 1 + elif [[ "${projectversion}" =~ "SNAPSHOT" ]] + then + echo "This is a SNAPSHOT version" + exit 1 + fi + echo "${projectversion}" + git tag -a "v${projectversion}" -m "releasing v${projectversion}" && git push origin v"${projectversion}" + ''' + } + } + } } post { From 94e924507b7c082f8ce276ffb5545a5d6cea1f8e Mon Sep 17 00:00:00 2001 From: Release-Tool Date: Fri, 3 May 2024 15:17:21 +0200 Subject: [PATCH 8/8] Release v24.04.2 --- module-base/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module-base/pom.xml b/module-base/pom.xml index d444822..6bda747 100644 --- a/module-base/pom.xml +++ b/module-base/pom.xml @@ -3,7 +3,7 @@ io.goobi.workflow.plugin plugin-step-urn - 24.03-SNAPSHOT + 24.04.2 plugin-step-urn-base jar diff --git a/pom.xml b/pom.xml index 5b1037f..aefa936 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.goobi.workflow workflow-base - 24.03-SNAPSHOT + 24.04.2 io.goobi.workflow.plugin