printnatura/Jenkinsfile

55 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

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