jenkins: fixup pipeline into multibranch structure
This commit is contained in:
Vendored
+18
-8
@@ -1,4 +1,11 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
|
agent none
|
||||||
|
stages {
|
||||||
|
stage('Main') {
|
||||||
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
branch 'main'
|
||||||
|
}
|
||||||
agent { label 'agent-12' }
|
agent { label 'agent-12' }
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
@@ -20,28 +27,31 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Testing') {
|
||||||
pipeline {
|
when {
|
||||||
|
beforeAgent true
|
||||||
|
not { branch 'main' }
|
||||||
|
}
|
||||||
agent { label 'agent-13' }
|
agent { label 'agent-13' }
|
||||||
stages {
|
stage('Test Checkout') {
|
||||||
stage('Checkout') {
|
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Test Build') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.build('trianta.dev:latest')
|
docker.build('test.trianta.dev:latest')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Test Deploy') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker stop test.trianta.dev && docker rm test.trianta.dev || exit 0'
|
sh 'docker stop test.trianta.dev && docker rm test.trianta.dev || exit 0'
|
||||||
sh 'docker run -d -e USER=scv -e USER_UID=1001-e USER_GID=1001 --restart=unless-stopped -p 3466:80 --name test.trianta.dev test.trianta.dev:latest'
|
sh 'docker run -d -e USER=scv -e USER_UID=1001-e USER_GID=1001 --restart=unless-stopped -p 3466:80 --name test.trianta.dev test.trianta.dev:latest'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user