[CI-SKIP] implement pipeline ci-skip

This commit is contained in:
Gabriele C 2018-03-13 12:44:54 +01:00 committed by GitHub
parent 8a66a92f81
commit d503d2c061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

42
Jenkinsfile vendored
View File

@ -5,43 +5,52 @@ pipeline {
jdk 'OracleJDK 8' jdk 'OracleJDK 8'
} }
stages { stages {
stage ('Clean') { stage ('prepare') {
steps {
env.CI_SKIP = "false"
result = sh (script: "git log -1 | grep '(?s).[CI[-\s]SKIP].*'", returnStatus: true)
if (result == 0) {
env.CI_SKIP = "true"
error "'[CI-SKIP]' found in git commit message. Aborting."
}
}
}
stage ('clean') {
steps { steps {
echo 'Cleaning the maven workspace...' echo 'Cleaning the maven workspace...'
sh 'mvn clean' sh 'mvn clean'
} }
} }
stage ('Dependencies') { stage ('dependencies') {
steps { steps {
echo 'Downloading dependencies...' echo 'Downloading dependencies...'
sh 'mvn dependency:go-offline' sh 'mvn dependency:go-offline'
} }
post { post {
success { success {
junit 'target/surefire-reports/**/*.xml'
archiveArtifacts artifacts: 'target/nukkit-*-SNAPSHOT.jar', fingerprint: true archiveArtifacts artifacts: 'target/nukkit-*-SNAPSHOT.jar', fingerprint: true
} }
} }
} }
stage ('Validate') { stage ('validate') {
steps { steps {
echo 'Validating the maven project...' echo 'Validating the maven project...'
sh 'mvn -o validate' sh 'mvn -o validate'
} }
} }
stage ('Compile') { stage ('compile') {
steps { steps {
echo 'Compiling source classes...' echo 'Compiling source classes...'
sh 'mvn -o compile' sh 'mvn -o compile'
} }
} }
stage ('Compile-Test') { stage ('compile-test') {
steps { steps {
echo 'Compiling test classes...' echo 'Compiling test classes...'
sh 'mvn -o test-compile' sh 'mvn -o test-compile'
} }
} }
stage ('Test') { stage ('test') {
steps { steps {
echo 'Performing unit testing...' echo 'Performing unit testing...'
sh 'mvn -o test' sh 'mvn -o test'
@ -53,7 +62,7 @@ pipeline {
} }
} }
} }
stage ('Package') { stage ('package') {
steps { steps {
echo 'Preparing the final package...' echo 'Preparing the final package...'
sh 'mvn -o package' sh 'mvn -o package'
@ -65,7 +74,7 @@ pipeline {
} }
} }
} }
stage ('Sources') { stage ('sources') {
when { when {
branch "master" branch "master"
} }
@ -80,7 +89,7 @@ pipeline {
} }
} }
} }
stage ('Javadoc') { stage ('javadoc') {
when { when {
branch "master" branch "master"
} }
@ -100,19 +109,19 @@ pipeline {
} }
} }
} }
stage ('Verify') { stage ('verify') {
steps { steps {
echo 'Performing integration testing...' echo 'Performing integration testing...'
sh 'mvn -o verify' sh 'mvn -o verify'
} }
} }
stage ('Install') { stage ('install') {
steps { steps {
echo 'Installing artifacts to the local repository...' echo 'Installing artifacts to the local repository...'
sh 'mvn -o install' sh 'mvn -o install'
} }
} }
stage ('Deploy') { stage ('deploy') {
when { when {
branch "master" branch "master"
} }
@ -121,5 +130,12 @@ pipeline {
sh 'mvn -o deploy' sh 'mvn -o deploy'
} }
} }
post {
always {
if (env.CI_SKIP == "true") {
currentBuild.result = 'NOT_BUILT'
}
}
}
} }
} }