84 lines
2.3 KiB
Groovy
84 lines
2.3 KiB
Groovy
pipeline {
|
|
agent {
|
|
docker 'node:lts-alpine3.16'
|
|
}
|
|
|
|
environment {
|
|
NPM_REGISTRY = 'https://nexus.nclazz.de/repository/npm_releases'
|
|
NPM_CREDENTIALS = credentials('jenkins_nexus')
|
|
NPM_MAIL = 'robots@nclazz.de'
|
|
APIBUILDER_TOKEN = credentials('apibuilder_token')
|
|
}
|
|
|
|
options {
|
|
timeout(time: 30, unit: "MINUTES")
|
|
}
|
|
|
|
stages {
|
|
stage('Prepare build') {
|
|
steps {
|
|
sh 'yarn install'
|
|
sh "yarn run registry:login --config-path ./.npmrc -u $NPM_CREDENTIALS_USR -p $NPM_CREDENTIALS_PSW -e $NPM_MAIL -r $NPM_REGISTRY"
|
|
}
|
|
}
|
|
stage('Run build') {
|
|
steps {
|
|
sh 'yarn build:ci'
|
|
}
|
|
post {
|
|
always {
|
|
junit(
|
|
allowEmptyResults: true,
|
|
testResults: '**/**/junit.xml'
|
|
)
|
|
}
|
|
}
|
|
}
|
|
stage('Publish npm packages') {
|
|
when {
|
|
anyOf {
|
|
allOf {
|
|
branch 'master'
|
|
buildingTag()
|
|
}
|
|
branch 'develop'
|
|
}
|
|
}
|
|
steps {
|
|
sh 'yarn run publish:ci'
|
|
}
|
|
}
|
|
// stage('Publish apibuilder specs') {
|
|
// steps {
|
|
// sh 'yarn publish:apibuilder'
|
|
// }
|
|
// }
|
|
}
|
|
post {
|
|
always {
|
|
cleanWs()
|
|
}
|
|
failure {
|
|
slackSend(
|
|
channel: "notifications",
|
|
color: "danger",
|
|
message: "There is a *build failure* in ${env.JOB_NAME}.\nBuild: ${env.RUN_DISPLAY_URL} "
|
|
)
|
|
}
|
|
unstable {
|
|
slackSend(
|
|
channel: "notifications",
|
|
color: "warning",
|
|
message: "Some tests have failed in ${env.JOB_NAME}.\nBuild: ${env.RUN_DISPLAY_URL} "
|
|
)
|
|
}
|
|
fixed {
|
|
slackSend(
|
|
channel: "notifications",
|
|
color: "good",
|
|
message: "The build ${env.JOB_NAME} completed successfully and is back to normal.\nBuild: ${env.RUN_DISPLAY_URL} "
|
|
)
|
|
}
|
|
}
|
|
}
|