SEBSERV-2 #jenkins binding
This commit is contained in:
parent
f81a20bd03
commit
2ac1b9cb75
2 changed files with 129 additions and 1 deletions
62
Jenkinsfile
vendored
Normal file
62
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
void setBuildStatus(String message, String state) {
|
||||
step([
|
||||
$class: "GitHubCommitStatusSetter",
|
||||
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${env.GIT_URL}"],
|
||||
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
|
||||
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
|
||||
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
|
||||
]);
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Maven build') {
|
||||
steps {
|
||||
withMaven(maven: 'Maven', options: [findbugsPublisher(disabled: true)]) {
|
||||
sh "mvn clean install -e -P let_reporting"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Reporting') {
|
||||
steps {
|
||||
pmd canComputeNew: false, defaultEncoding: '', healthy: '', pattern: '**/target/pmd.xml', thresholdLimit: 'high', unHealthy: ''
|
||||
findbugs canComputeNew: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', isRankActivated: true, pattern: '**/target/findbugsXml.xml', unHealthy: ''
|
||||
jacoco classPattern: '**/build/classes/*/main/', execPattern: '**/target/jacoco.exec', sourcePattern: '**/src/main/java'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Tag') {
|
||||
steps {
|
||||
echo 'Build is tagged here.'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push to Nexus') {
|
||||
steps {
|
||||
echo 'Build is pushed to Nexus here.'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
failure {
|
||||
setBuildStatus("Build failed", "FAILURE");
|
||||
emailext body: "The build of the LET Application (${env.JOB_NAME}) failed! See ${env.BUILD_URL}", recipientProviders: [[$class: 'CulpritsRecipientProvider']], subject: 'LET Application Build Failure'
|
||||
}
|
||||
success {
|
||||
setBuildStatus("Build complete", "SUCCESS");
|
||||
}
|
||||
}
|
||||
options {
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '7'))
|
||||
}
|
||||
triggers {
|
||||
pollSCM('H/5 * * * *')
|
||||
}
|
||||
|
||||
}
|
68
pom.xml
68
pom.xml
|
@ -145,7 +145,73 @@
|
|||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>let_reporting</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>3.10.0</version>
|
||||
<configuration>
|
||||
<skipEmptyReport>false</skipEmptyReport>
|
||||
<failOnViolation>false</failOnViolation>
|
||||
<targetJdk>${java.version}</targetJdk>
|
||||
<linkXRef>false</linkXRef>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
<goal>cpd-check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<configuration>
|
||||
<effort>Max</effort>
|
||||
<failOnError>false</failOnError>
|
||||
<threshold>Low</threshold>
|
||||
<xmlOutput>true</xmlOutput>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>analyze-compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>ch/ethz/seb/sebserver/*</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-prepare-agent</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
Loading…
Reference in a new issue