2020-01-14 12:30:11 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
environment {
|
|
|
|
PROJECT_NAME = 'vn-support'
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Checkout') {
|
|
|
|
steps {
|
2024-05-27 11:42:17 +00:00
|
|
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
|
|
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
2020-01-14 12:30:11 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-29 21:48:20 +00:00
|
|
|
stage('Build') {
|
2020-01-14 12:30:11 +00:00
|
|
|
when {
|
|
|
|
branch 'master'
|
|
|
|
}
|
|
|
|
environment {
|
2020-01-31 20:29:10 +00:00
|
|
|
CREDENTIALS = credentials('docker-registry')
|
2020-01-14 12:30:11 +00:00
|
|
|
}
|
2021-04-29 21:48:20 +00:00
|
|
|
steps {
|
2024-05-27 11:42:17 +00:00
|
|
|
script {
|
|
|
|
def packageJson = readJSON file: 'package.json'
|
|
|
|
env.VERSION = packageJson.version
|
|
|
|
}
|
2021-04-29 21:48:20 +00:00
|
|
|
dockerBuild()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deploy') {
|
|
|
|
when {
|
|
|
|
branch 'master'
|
|
|
|
}
|
2020-01-14 12:30:11 +00:00
|
|
|
steps {
|
2024-05-27 11:42:17 +00:00
|
|
|
script {
|
|
|
|
def packageJson = readJSON file: 'package.json'
|
|
|
|
env.VERSION = packageJson.version
|
|
|
|
}
|
|
|
|
withKubeConfig([
|
|
|
|
serverUrl: "$KUBERNETES_API",
|
|
|
|
credentialsId: 'kubernetes',
|
|
|
|
namespace: 'support'
|
|
|
|
]) {
|
|
|
|
sh 'kubectl set image deployment/support support=$REGISTRY/vn-support:$VERSION'
|
|
|
|
}
|
2020-01-14 12:30:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
2024-05-27 11:42:17 +00:00
|
|
|
setEnv()
|
2020-01-31 20:29:10 +00:00
|
|
|
sendEmail()
|
2020-01-14 12:30:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|