build: refs #5483 send rocket message, skip steps when run source isn't git
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
acf47468c0
commit
56ac47dc16
|
@ -6,7 +6,7 @@ pipeline {
|
|||
}
|
||||
environment {
|
||||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
|
@ -22,6 +22,9 @@ pipeline {
|
|||
env.BACK_REPLICAS = 2
|
||||
break
|
||||
}
|
||||
|
||||
if (env.JOB_NAME.startsWith('gitea/')
|
||||
env.RUN_SOURCE = 'git'
|
||||
}
|
||||
|
||||
configFileProvider([
|
||||
|
@ -46,10 +49,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Test') {
|
||||
when { not { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}}
|
||||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
not { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
}
|
||||
environment {
|
||||
NODE_ENV = ""
|
||||
TZ = 'Europe/Madrid'
|
||||
|
@ -72,10 +78,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Build') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
CREDENTIALS = credentials('docker-registry')
|
||||
}
|
||||
|
@ -88,10 +97,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
}
|
||||
|
@ -120,6 +132,25 @@ pipeline {
|
|||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
if (env.RUN_SOURCE == 'git'
|
||||
&& ['master', 'test'].contains(env.BRANCH_NAME)) {
|
||||
String message = env.GIT_COMMIT_MSG
|
||||
int index = message.indexOf('\n')
|
||||
if (index != -1)
|
||||
message = message.substring(0, index)
|
||||
|
||||
rocketSend(
|
||||
channel: 'vn-database',
|
||||
message: "*DB version uploaded:* ${message}"
|
||||
+"\n$COMMITTER_EMAIL ($BRANCH_NAME)"
|
||||
+"\n$GIT_URL/commit/$GIT_COMMIT",
|
||||
rawMessage: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
always {
|
||||
script {
|
||||
if (!['master', 'test'].contains(env.BRANCH_NAME)) {
|
||||
|
|
Loading…
Reference in New Issue