pipeline {
agent any
stages {
stage('Checkout') {
steps {
script {
git(url: 'ssh://my.git', branch: 'testing', changelog: true)
//git(url: 'ssh://my.git', branch: 'testing')
//def GIT_VERSION=$(git tag -l [0-9].* --points-at origin/testing | tail -n1)
//def GIT_VERSION = sh(returnStdout: true, script: 'git tag -l [0-9].* --points-at testing | tail -n1')
sh '''
export GIT_VERSION=$(git tag -l [0-9].* --points-at origin/testing | tail -n1)
echo $GIT_VERSION'''
}
}
}
}
stage('Parallel Deployment') {
parallel {
stage('Deployments') {
steps {
sh '''echo "Package deployment to all servers"
echo $GIT_VERSION'''
}
}
stage('server1') {
steps {
sh '''scp myapp-${GIT_VER}-${BUILD_NUMBER}.build'''
}
}
stage('server2') {
steps {
sh '''scp myapp-${GIT_VER}-${BUILD_NUMBER}.build'''
}
}
}
}
}