From 3ca5d64a229a823db468fd50f708454e5fa121ff Mon Sep 17 00:00:00 2001 From: Philipp Czora Date: Thu, 5 Oct 2017 10:00:45 +0200 Subject: [PATCH 01/10] Adds integration test & edits Jenkins pipeline accordingly --- Jenkinsfile | 14 +- pom.xml | 453 +++++++++--------- .../owner/OwnerControllerITCase.java | 30 ++ 3 files changed, 275 insertions(+), 222 deletions(-) create mode 100644 src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java diff --git a/Jenkinsfile b/Jenkinsfile index 24038cb06..e5117d87f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,12 +18,20 @@ node { stage('Test') { String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; - mvn "${jacoco}:prepare-agent verify ${jacoco}:report" + mvn "${jacoco}:prepare-agent test ${jacoco}:report" // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' + junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' } - + + stage('Integration Test') { + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" + + // Archive JUnit results, if any + junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' + } + stage('SonarQube Analysis') { withCredentials([credentials]) { //noinspection GroovyAssignabilityCheck diff --git a/pom.xml b/pom.xml index a8a1eec00..776cd1a43 100644 --- a/pom.xml +++ b/pom.xml @@ -1,230 +1,245 @@ - 4.0.0 - org.springframework.samples - spring-petclinic - 1.5.2-SNAPSHOT + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + org.springframework.samples + spring-petclinic + 1.5.2-SNAPSHOT - - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE - - petclinic - - - - - 1.8 - UTF-8 - UTF-8 - - - 3.3.6 - 1.11.4 - 2.2.4 - 1.8.0 - 3.0.6.RELEASE - - 2.7 - - - - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - nz.net.ultraq.thymeleaf - thymeleaf-layout-dialect - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.hsqldb - hsqldb - runtime - - - mysql - mysql-connector-java - runtime - - - - - javax.cache - cache-api - - - org.ehcache - ehcache - - - - - org.webjars - webjars-locator - - - org.webjars - jquery - ${webjars-jquery.version} - - - org.webjars - jquery-ui - ${webjars-jquery-ui.version} - - - org.webjars - bootstrap - ${webjars-bootstrap.version} - - - - - org.springframework.boot - spring-boot-devtools - runtime - - - - - spring-petclinic - - + org.springframework.boot - spring-boot-maven-plugin - - - - - build-info - - - true - - ${project.build.sourceEncoding} - ${project.reporting.outputEncoding} - ${maven.compiler.source} - ${maven.compiler.target} - - - - - - - org.codehaus.mojo - cobertura-maven-plugin - ${cobertura.version} - - - - - - - clean - check - - - - + spring-boot-starter-parent + 1.5.4.RELEASE + + petclinic - - - pl.project13.maven - git-commit-id-plugin - - - - revision - - - - - true - yyyy-MM-dd'T'HH:mm:ssZ - true - ${project.build.outputDirectory}/git.properties - - false - - + - - ro.isdc.wro4j - wro4j-maven-plugin - ${wro4j.version} - - - generate-resources - - run - - - - - ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory - ${project.build.directory}/classes/static/resources/css - ${basedir}/src/main/wro/wro.xml - ${basedir}/src/main/wro/wro.properties - ${basedir}/src/main/less - - - + + 1.8 + UTF-8 + UTF-8 + + + 3.3.6 + 1.11.4 + 2.2.4 + 1.8.0 + 3.0.6.RELEASE + + 2.7 + + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + nz.net.ultraq.thymeleaf + thymeleaf-layout-dialect + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.hsqldb + hsqldb + runtime + + + mysql + mysql-connector-java + runtime + + + + + javax.cache + cache-api + + + org.ehcache + ehcache + + + + + org.webjars + webjars-locator + + + org.webjars + jquery + ${webjars-jquery.version} + + + org.webjars + jquery-ui + ${webjars-jquery-ui.version} + + org.webjars bootstrap ${webjars-bootstrap.version} - - - - - - - - - - org.codehaus.mojo - cobertura-maven-plugin - ${cobertura.version} - - - html - - - - - - + + + + + org.springframework.boot + spring-boot-devtools + runtime + + + + + spring-petclinic + + + org.springframework.boot + spring-boot-maven-plugin + + + + + build-info + + + true + + ${project.build.sourceEncoding} + ${project.reporting.outputEncoding} + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + integration-test + + integration-test + verify + + + + + + org.codehaus.mojo + cobertura-maven-plugin + ${cobertura.version} + + + + + + + clean + check + + + + + + + + pl.project13.maven + git-commit-id-plugin + + + + revision + + + + + true + yyyy-MM-dd'T'HH:mm:ssZ + true + ${project.build.outputDirectory}/git.properties + + false + + + + + ro.isdc.wro4j + wro4j-maven-plugin + ${wro4j.version} + + + generate-resources + + run + + + + + ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory + + ${project.build.directory}/classes/static/resources/css + ${basedir}/src/main/wro/wro.xml + ${basedir}/src/main/wro/wro.properties + ${basedir}/src/main/less + + + + org.webjars + bootstrap + ${webjars-bootstrap.version} + + + + + + + + + + org.codehaus.mojo + cobertura-maven-plugin + ${cobertura.version} + + + html + + + + + + diff --git a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java new file mode 100644 index 000000000..0fc488b1f --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java @@ -0,0 +1,30 @@ +package org.springframework.samples.petclinic.owner; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@Ignore +public class OwnerControllerITCase { + + @Autowired + private TestRestTemplate restTemplate; + + /** + * Note: This test exists only for the purpose of serving as an example! Please write tests more sensible + * than this for your own applications. + */ + @Test + public void assertsUser1IsGeorgeFranklin() { + String body = this.restTemplate.getForObject("/owners/1", String.class); + assertThat(body).contains("George Franklin"); + } +} From 0f708a3709e1880b786cff4d65daad292218a6ec Mon Sep 17 00:00:00 2001 From: Philipp Czora Date: Thu, 5 Oct 2017 12:47:23 +0200 Subject: [PATCH 02/10] Unignores integration test --- Jenkinsfile | 4 ++-- .../samples/petclinic/owner/OwnerControllerITCase.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e5117d87f..c567cf05b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { mvn "${jacoco}:prepare-agent test ${jacoco}:report" // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' + junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' } stage('Integration Test') { @@ -29,7 +29,7 @@ node { mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' + junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' } stage('SonarQube Analysis') { diff --git a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java index 0fc488b1f..3ffd69ce0 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerITCase.java @@ -12,7 +12,6 @@ import static org.assertj.core.api.Assertions.assertThat; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@Ignore public class OwnerControllerITCase { @Autowired From a33431821ba97a34f53ab4ee36fb4f09d1f26a46 Mon Sep 17 00:00:00 2001 From: Philipp Czora Date: Mon, 9 Oct 2017 09:56:08 +0200 Subject: [PATCH 03/10] Adds smeagol example --- smeagol_docs/01_Hello.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 smeagol_docs/01_Hello.md diff --git a/smeagol_docs/01_Hello.md b/smeagol_docs/01_Hello.md new file mode 100644 index 000000000..26e6186e9 --- /dev/null +++ b/smeagol_docs/01_Hello.md @@ -0,0 +1,7 @@ +# Hello world! + +Welcome to the Smeagol-Demo! Have some embedded PlantUML: + +@startuml +Bob -> Alice : hello +@enduml From f4ebbafc143217d0530591ed2b3afe4184e752dc Mon Sep 17 00:00:00 2001 From: Philipp Czora Date: Mon, 9 Oct 2017 15:02:25 +0200 Subject: [PATCH 04/10] Adds .smeagol.yml and renames smeagol main page --- .smeagol.yml | 0 smeagol_docs/01_Hello.md => docs/Home.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 .smeagol.yml rename smeagol_docs/01_Hello.md => docs/Home.md (100%) diff --git a/.smeagol.yml b/.smeagol.yml new file mode 100644 index 000000000..e69de29bb diff --git a/smeagol_docs/01_Hello.md b/docs/Home.md similarity index 100% rename from smeagol_docs/01_Hello.md rename to docs/Home.md From e92ae405dd67b7c026e48409dbdab037c0eaad05 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Mon, 9 Oct 2017 15:31:28 +0200 Subject: [PATCH 05/10] Jenkins: Run Test & Deploy stages in parallel --- Jenkinsfile | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c567cf05b..1e4acfee8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,21 +16,26 @@ node { archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true } - stage('Test') { - String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; - mvn "${jacoco}:prepare-agent test ${jacoco}:report" + parallel( + test: { + stage('Test') { + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + mvn "${jacoco}:prepare-agent test ${jacoco}:report" - // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' - } + // Archive JUnit results, if any + junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' + } + }, + integrationTest: { + stage('Integration Test') { + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" - stage('Integration Test') { - String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; - mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" - - // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' - } + // Archive JUnit results, if any + junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' + } + } + ) stage('SonarQube Analysis') { withCredentials([credentials]) { @@ -40,15 +45,21 @@ node { } } - stage('Deploy Artifacts') { - String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; - String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; - mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" - } + parallel( + deployArtifacts: { + stage('Deploy Artifacts') { + String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; + String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; + mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" + } + }, + deployApplication: { - stage('Deploy Application') { - sh "ansible-playbook playbook.yaml" - } + stage('Deploy Application') { + sh "ansible-playbook playbook.yaml" + } + } + ) } String cesFqdn; From ef3e3defd47691a9d582235236fbc55d203bdefe Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 10 Oct 2017 16:46:19 +0200 Subject: [PATCH 06/10] Jenkins: Archive JUnit results also on failing tests --- Jenkinsfile | 120 ++++++++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1e4acfee8..8ad049d76 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,75 +1,75 @@ #!groovy node { - cesFqdn = "ecosystem.cloudogu.net"; - cesUrl = "https://${cesFqdn}"; - credentials = usernamePassword(credentialsId: 'scmCredentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME'); + cesFqdn = "ecosystem.cloudogu.net" + cesUrl = "https://${cesFqdn}" + credentials = usernamePassword(credentialsId: 'scmCredentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME') - stage('Checkout') { - checkout scm - } + catchError { - stage('Build') { - mvn "-DskipTests clean package" - - // archive artifact - archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true - } - - parallel( - test: { - stage('Test') { - String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; - mvn "${jacoco}:prepare-agent test ${jacoco}:report" - - // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml' - } - }, - integrationTest: { - stage('Integration Test') { - String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; - mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" - - // Archive JUnit results, if any - junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml' - } - } - ) - - stage('SonarQube Analysis') { - withCredentials([credentials]) { - //noinspection GroovyAssignabilityCheck - mvn "org.codehaus.mojo:sonar-maven-plugin:3.2:sonar -Dsonar.host.url=${cesUrl}/sonar " + - "-Dsonar.login=${USERNAME} -Dsonar.password=${PASSWORD} -Dsonar.exclusions=target/**" + stage('Checkout') { + checkout scm } + + stage('Build') { + mvn "-DskipTests clean package" + + // archive artifact + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true + } + + parallel( + test: { + stage('Test') { + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + mvn "${jacoco}:prepare-agent test ${jacoco}:report" + } + }, + integrationTest: { + stage('Integration Test') { + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + mvn "${jacoco}:prepare-agent-integration failsafe:integration-test ${jacoco}:report-integration" + } + } + ) + + stage('SonarQube Analysis') { + withCredentials([credentials]) { + //noinspection GroovyAssignabilityCheck + mvn "org.codehaus.mojo:sonar-maven-plugin:3.2:sonar -Dsonar.host.url=${cesUrl}/sonar " + + "-Dsonar.login=${USERNAME} -Dsonar.password=${PASSWORD} -Dsonar.exclusions=target/**" + } + } + + parallel( + deployArtifacts: { + stage('Deploy Artifacts') { + String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; + String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; + mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" + } + }, + deployApplication: { + + stage('Deploy Application') { + sh "ansible-playbook playbook.yaml" + } + } + ) } - parallel( - deployArtifacts: { - stage('Deploy Artifacts') { - String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; - String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; - mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" - } - }, - deployApplication: { - - stage('Deploy Application') { - sh "ansible-playbook playbook.yaml" - } - } - ) + // Archive Unit and integration test results, if any + junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml' } -String cesFqdn; -String cesUrl; -def credentials; +String cesFqdn +String cesUrl +def credentials void mvn(String args) { - writeSettingsXml() - sh "./mvnw -s settings.xml --batch-mode -V -U -e -Dsurefire.useFile=false ${args}" - sh 'rm -f settings.xml' + writeSettingsXml() + sh "./mvnw -s settings.xml --batch-mode -V -U -e -Dsurefire.useFile=false ${args}" + sh 'rm -f settings.xml' } void writeSettingsXml() { From b5b2dcf1c1455a4824fa9265f45833fff5417798 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 12 Dec 2017 09:22:29 +0100 Subject: [PATCH 07/10] Jenkins: Discover FQDN from env var instead of using hard-coded one. Makes pipeline less dependent to environment. --- Jenkinsfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ad049d76..c95dde4c8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ #!groovy node { - cesFqdn = "ecosystem.cloudogu.net" + cesFqdn = findHostName() cesUrl = "https://${cesFqdn}" credentials = usernamePassword(credentialsId: 'scmCredentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME') @@ -21,7 +21,7 @@ node { parallel( test: { stage('Test') { - String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606"; + String jacoco = "org.jacoco:jacoco-maven-plugin:0.7.7.201606060606" mvn "${jacoco}:prepare-agent test ${jacoco}:report" } }, @@ -72,6 +72,16 @@ void mvn(String args) { sh 'rm -f settings.xml' } +String findHostName() { + String regexMatchesHostName = 'https?://([^:/]*)' + + // Storing matcher in a variable might lead to java.io.NotSerializableException: java.util.regex.Matcher + if (!(env.JENKINS_URL =~ regexMatchesHostName)) { + script.error 'Unable to determine hostname from env.JENKINS_URL. Expecting http(s)://server:port/jenkins' + } + return (env.JENKINS_URL =~ regexMatchesHostName)[0][1] +} + void writeSettingsXml() { withCredentials([credentials]) { writeFile file: "settings.xml", text: """ From 6ec7e7eee27326439b6dd45931894a9422b98038 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 12 Dec 2017 09:25:47 +0100 Subject: [PATCH 08/10] Jenkins: Removes deploy application stage. Makes pipeline less dependent to its environment. No longer needs a preconfigured slave an a host to deploy the petclinic to via SSH. The demo content can now be used on more environments. --- Jenkinsfile | 20 +++--------- playbook.yaml | 39 ----------------------- src/main/systemd/spring-petclinic.service | 11 ------- 3 files changed, 5 insertions(+), 65 deletions(-) delete mode 100644 playbook.yaml delete mode 100644 src/main/systemd/spring-petclinic.service diff --git a/Jenkinsfile b/Jenkinsfile index c95dde4c8..154ce3e22 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,21 +41,11 @@ node { } } - parallel( - deployArtifacts: { - stage('Deploy Artifacts') { - String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; - String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; - mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" - } - }, - deployApplication: { - - stage('Deploy Application') { - sh "ansible-playbook playbook.yaml" - } - } - ) + stage('Deploy Artifacts') { + String releaseProp = "-DaltReleaseDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/releases/"; + String snapshotProp = "-DaltSnapshotDeploymentRepository=${cesFqdn}::default::${cesUrl}/nexus/content/repositories/snapshots/"; + mvn "-DskipTests deploy ${releaseProp} ${snapshotProp}" + } } // Archive Unit and integration test results, if any diff --git a/playbook.yaml b/playbook.yaml deleted file mode 100644 index ba33b91d8..000000000 --- a/playbook.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- - -- hosts: all - become: yes - gather_facts: yes - - tasks: - - name: Copy systemd descriptor - copy: - src: src/main/systemd/spring-petclinic.service - dest: /etc/systemd/system/spring-petclinic.service - notify: - - reload systemd - - - name: Copy spring-petclinic - copy: - src: target/spring-petclinic.jar - dest: /opt/spring-petclinic.jar - owner: deploy - mode: u+rwx - notify: - - restart service - - - name: Enable service - service: - name: spring-petclinic - enabled: yes - - handlers: - - name: reload systemd - systemd: - name: spring-petclinic - daemon_reload: yes - - - name: restart service - service: - name: spring-petclinic - state: restarted - diff --git a/src/main/systemd/spring-petclinic.service b/src/main/systemd/spring-petclinic.service deleted file mode 100644 index d0faf84d1..000000000 --- a/src/main/systemd/spring-petclinic.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=spring-petclinic -After=syslog.target - -[Service] -User=deploy -ExecStart=/opt/spring-petclinic.jar -SuccessExitStatus=143 - -[Install] -WantedBy=multi-user.target From 3c5b37e4514768d208689b5694d9201d5e8aab30 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 12 Dec 2017 12:46:44 +0100 Subject: [PATCH 09/10] Jenkins: Init global variables in order to avoid NPE. Occurs in Jenkins ver. 2.73.3 and Pipeline: Groovy Plugin 2.42. java.lang.NullPointerException at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isVarArgsMethod(GroovyCallSiteSelector.java:231) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:200) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.staticMethod(GroovyCallSiteSelector.java:193) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:153) at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:186) at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:190) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:97) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) at WorkflowScript.run(WorkflowScript:42) at ___cps.transform___(Native Method) --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 154ce3e22..5fd7f5728 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,9 +52,10 @@ node { junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml' } -String cesFqdn -String cesUrl -def credentials +// Init global vars in order to avoid NPE +String cesFqdn = '' +String cesUrl = '' +def credentials= {} void mvn(String args) { writeSettingsXml() From 54d996f4027ed62fb9f485c08b6046d9c60240fa Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 9 Jan 2018 16:20:24 +0100 Subject: [PATCH 10/10] Jenkins: Disables concurrent builds. Because ITs use the same port causing random failures on concurrent builds. --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 5fd7f5728..f102d0f1f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ #!groovy node { + properties([ + // Don't run concurrent builds, because the ITs use the same port causing random failures on concurrent builds. + disableConcurrentBuilds() + ]) + cesFqdn = findHostName() cesUrl = "https://${cesFqdn}" credentials = usernamePassword(credentialsId: 'scmCredentials', passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')