vn-support/Jenkinsfile

55 lines
1.4 KiB
Groovy

#!/usr/bin/env groovy
pipeline {
agent any
environment {
PROJECT_NAME = 'vn-support'
}
stages {
stage('Checkout') {
steps {
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
}
}
stage('Build') {
when {
branch 'master'
}
environment {
CREDENTIALS = credentials('docker-registry')
}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
dockerBuild()
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
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'
}
}
}
}
post {
always {
setEnv()
sendEmail()
}
}
}