2024-04-04 09:33:29 +00:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
options {
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
when {branch 'master'}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
def packageJson = readJSON file: 'package.json'
|
|
|
|
env.VERSION = packageJson.version
|
|
|
|
}
|
|
|
|
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Push') {
|
|
|
|
when {branch 'master'}
|
|
|
|
environment {
|
|
|
|
CREDENTIALS = credentials('docker-registry')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
def packageJson = readJSON file: 'package.json'
|
|
|
|
env.VERSION = packageJson.version
|
|
|
|
}
|
2024-04-04 13:04:12 +00:00
|
|
|
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
2024-04-04 09:33:29 +00:00
|
|
|
sh 'docker-compose push'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
unsuccessful {
|
|
|
|
setEnv()
|
|
|
|
sendEmail()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|