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