vn-rfid/Jenkinsfile

55 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2023-01-24 09:11:58 +00:00
#!/usr/bin/env groovy
pipeline {
agent any
environment {
PROJECT_NAME = 'vn-rfid'
}
stages {
2024-06-13 07:04:14 +00:00
stage('Setup') {
2023-01-24 09:11:58 +00:00
steps {
2024-06-13 07:04:14 +00:00
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
2023-01-24 09:11:58 +00:00
}
}
stage('Build') {
2024-06-13 07:04:14 +00:00
when {
2023-01-24 09:11:58 +00:00
branch 'master'
2024-06-13 07:04:14 +00:00
}
2023-01-24 09:11:58 +00:00
environment {
CREDENTIALS = credentials('docker-registry')
}
steps {
2024-06-13 07:04:14 +00:00
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
2023-01-24 09:11:58 +00:00
dockerBuild()
}
}
stage('Deploy') {
2024-06-13 07:04:14 +00:00
when {
2023-01-24 09:11:58 +00:00
branch 'master'
}
steps {
2024-06-13 07:04:14 +00:00
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
}
withKubeConfig([
serverUrl: "$KUBERNETES_API",
credentialsId: 'kubernetes',
namespace: 'vn-rfid'
]) {
sh 'kubectl set image deployment/vn-rfid vn-rfid=$REGISTRY/vn-rfid:$VERSION'
}
2023-01-24 09:11:58 +00:00
}
}
}
post {
always {
2024-06-13 07:04:14 +00:00
setEnv()
sendEmail()
2023-01-24 09:11:58 +00:00
}
}
2024-06-13 07:04:14 +00:00
}