From f724099945bef87ecd7a0815b0e6d75f2be84761 Mon Sep 17 00:00:00 2001 From: Kameron Kenny <1267885+kkenny@users.noreply.github.com> Date: Wed, 15 May 2024 19:01:22 -0400 Subject: [PATCH] fix logic. --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b31c4d1..3474a29 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { stage('Stop primary container') { steps { script { - def status_p = sh(returnStatus: true, script: 'docker images | grep bind9-primary | grep $(grep image docker-compose.yml | grep primary | awk -F\':\' \'{ print $4 }\')') + def status_p = sh(returnStatus: true, script: 'grep $(docker compose images | tail -n1 | awk \'{ print $2 ":" $3 }\') docker-compose.yml') if (status_p != 0) { sh 'docker compose down' @@ -53,7 +53,7 @@ pipeline { stage('Start primary container') { steps { script { - def status_p = sh(returnStatus: true, script: 'docker images | grep bind9-primary | grep $(grep image docker-compose.yml | grep primary | awk -F\':\' \'{ print $4 }\')') + def status_p = sh(returnStatus: true, script: 'grep $(docker compose images | tail -n1 | awk \'{ print $2 ":" $3 }\') docker-compose.yml') if (status_p != 0) { sh 'docker compose down' @@ -75,7 +75,7 @@ pipeline { stage('Stop secondary container') { steps { script { - def status_s = sh(returnStatus: true, script: 'docker images | grep bind9-secondary | grep $(grep image docker-compose.yml | grep secondary | awk -F\':\' \'{ print $4 }\')') + def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose images | tail -n1 | awk \'{ print $2 ":" $3 }\') docker-compose.yml') if (status_s != 0) { sh 'docker --context pi502 compose down' @@ -90,7 +90,7 @@ pipeline { stage('Start secondary container') { steps { script { - def status_s = sh(returnStatus: true, script: 'docker images | grep bind9-secondary | grep $(grep image docker-compose.yml | grep secondary | awk -F\':\' \'{ print $4 }\')') + def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose images | tail -n1 | awk \'{ print $2 ":" $3 }\') docker-compose.yml') if (status_s != 0) { sh 'docker --context pi502 compose up -d --no-color secondary'