added Jenkinsfile
nclazz/spring-boot-docker-secrets-maven-lib/pipeline/head There was a failure building this commit
Details
nclazz/spring-boot-docker-secrets-maven-lib/pipeline/head There was a failure building this commit
Details
parent
33777ef4ed
commit
96a892ff2a
|
@ -0,0 +1,97 @@
|
|||
pipeline {
|
||||
agent none
|
||||
|
||||
stages {
|
||||
stage('Maven Build') {
|
||||
agent {
|
||||
docker 'maven:3.8.3-openjdk-11'
|
||||
}
|
||||
stages {
|
||||
stage('Build project') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'jenkins_nexus', usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASSWORD')]) {
|
||||
sh 'mvn clean install -B -s settings.xml'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('Deploy Maven Artifact') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'master'; branch 'dev'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'jenkins_nexus', usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASSWORD')]) {
|
||||
sh 'mvn deploy -Dnexus.user=${USERNAME} -Dnexus.password=${PASSWORD} -B -s settings.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
node(null) {
|
||||
script {
|
||||
if(BRANCH_NAME == 'master' || BRANCH_NAME == 'dev') {
|
||||
emailext(
|
||||
to: "notifications@nclazz.de",
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
|
||||
body: """
|
||||
There is a build failure in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unstable {
|
||||
node(null) {
|
||||
script {
|
||||
if(BRANCH_NAME == 'master' || BRANCH_NAME == 'dev') {
|
||||
emailext(
|
||||
to: "notifications@nclazz.de",
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} unstable",
|
||||
body: """
|
||||
Some tests have failed in ${env.JOB_NAME}.
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fixed {
|
||||
node(null) {
|
||||
script {
|
||||
if(BRANCH_NAME == 'master' || BRANCH_NAME == 'dev') {
|
||||
emailext(
|
||||
to: "notifications@nclazz.de",
|
||||
from: "jenkins@nclazz.de",
|
||||
subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} fixed",
|
||||
body: """
|
||||
The build ${env.JOB_NAME} completed successfully and is back to normal.
|
||||
|
||||
Build: ${env.BUILD_URL}
|
||||
Logs: ${env.BUILD_URL}console
|
||||
Changes: ${env.BUILD_URL}changes
|
||||
--
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
||||
https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<localRepository />
|
||||
<interactiveMode />
|
||||
<offline />
|
||||
<pluginGroups />
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>nexus.nclazz.de</id>
|
||||
<name>NClazz Nexus Repository Manager</name>
|
||||
<url>https://nexus.nclazz.de/repository/maven-public</url>
|
||||
<mirrorOf>*</mirrorOf>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
<servers>
|
||||
<server>
|
||||
<id>nexus.nclazz.de</id>
|
||||
<username>${NEXUS_USER}</username>
|
||||
<password>${NEXUS_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<proxies />
|
||||
<profiles />
|
||||
<activeProfiles />
|
||||
</settings>
|
Loading…
Reference in New Issue