jenkins
This commit is contained in:
parent
1349822ff7
commit
ee0ba11677
|
@ -19,7 +19,7 @@ pipeline {
|
|||
script {
|
||||
def status = sh(returnStatus: true, script: 'docker images | grep nagios | grep $(grep image docker-compose.yml | awk -F\':\' \'{ print $4 }\')')
|
||||
|
||||
if (status_p != 0) {
|
||||
if (status != 0) {
|
||||
sh 'docker compose build --push'
|
||||
} else {
|
||||
echo "Primary Image version already exists, no need to rebuild."
|
||||
|
@ -37,9 +37,9 @@ pipeline {
|
|||
stage('Stop container') {
|
||||
steps {
|
||||
script {
|
||||
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi503 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
|
||||
def status = sh(returnStatus: true, script: 'grep $(docker --context pi503 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
|
||||
|
||||
if (status_s != 0) {
|
||||
if (status != 0) {
|
||||
sh 'docker --context pi503 compose down'
|
||||
sh 'sleep 5'
|
||||
} else {
|
||||
|
@ -52,9 +52,9 @@ pipeline {
|
|||
stage('Start container') {
|
||||
steps {
|
||||
script {
|
||||
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi503 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
|
||||
def status = sh(returnStatus: true, script: 'grep $(docker --context pi503 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
|
||||
|
||||
if (status_s != 0) {
|
||||
if (status != 0) {
|
||||
sh 'docker --context pi503 compose up -d'
|
||||
sh 'docker --context pi503 compose ps'
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue