Merge pull request #109 from kemitix/jenkins
Jenkins update to latest template
This commit is contained in:
commit
d39198a823
3 changed files with 47 additions and 28 deletions
28
Jenkinsfile
vendored
28
Jenkinsfile
vendored
|
@ -1,28 +0,0 @@
|
|||
final String gitRepoUrl = 'git@github.com:kemitix/kemitix-parent.git'
|
||||
final String mvn = "mvn --batch-mode --update-snapshots"
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
steps {
|
||||
git url: gitRepoUrl, branch: '**', credentialsId: 'github-kemitix'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
|
||||
sh "${mvn} clean install"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { expression { (env.GIT_BRANCH == 'master') } }
|
||||
steps {
|
||||
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 1.8') {
|
||||
sh "${mvn} deploy --activate-profiles release"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
Jenkinsfile.groovy
Normal file
46
Jenkinsfile.groovy
Normal file
|
@ -0,0 +1,46 @@
|
|||
final String repoName = "kemitix-parent"
|
||||
final String repoUrl = "git@github.com:kemitix/${repoName}.git"
|
||||
final String mvn = "mvn --batch-mode --update-snapshots"
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
steps {
|
||||
git url: repoUrl, branch: '**', credentialsId: 'github-kemitix'
|
||||
}
|
||||
}
|
||||
stage('no SNAPSHOT in master') {
|
||||
// checks that the pom version is not a snapshot when the current branch is master
|
||||
// TODO: also check for SNAPSHOT when is a pull request with master as the target branch
|
||||
when {
|
||||
expression {
|
||||
(env.GIT_BRANCH == 'master') &&
|
||||
(readMavenPom(file: 'pom.xml').version).contains("SNAPSHOT") }
|
||||
}
|
||||
steps {
|
||||
error("Build failed because SNAPSHOT version")
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
|
||||
sh 'mvn clean install'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving') {
|
||||
steps {
|
||||
archiveArtifacts 'pom.xml'
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { expression { (env.GIT_BRANCH == 'master') } }
|
||||
steps {
|
||||
withMaven(maven: 'maven 3.5.2', jdk: 'JDK 9') {
|
||||
sh "${mvn} deploy --activate-profiles release -DskipTests=true"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
lombok.config
Normal file
1
lombok.config
Normal file
|
@ -0,0 +1 @@
|
|||
lombok.addGeneratedAnnotation=false
|
Loading…
Reference in a new issue