This commit is contained in:
Kameron Kenny 2024-06-05 13:14:04 -04:00
parent 73754f484f
commit 0245bfd0db
No known key found for this signature in database
GPG Key ID: E5006629839D2276
1 changed files with 55 additions and 0 deletions

55
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,55 @@
pipeline {
agent {
label 'pi501.in.thelinuxpro.net'
}
stages {
stage("verify tooling") {
steps {
sh '''
docker version
docker info
docker compose version
'''
}
}
stage('Create contexts') {
steps {
sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"'
}
}
stage('Stop container') {
steps {
script {
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
if (status_s != 0) {
sh 'docker --context pi502 compose down'
sh 'sleep 5'
} else {
echo 'skip'
}
}
}
}
stage('Start container') {
steps {
script {
def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
if (status_s != 0) {
sh 'docker --context pi502 compose up -d'
sh 'docker --context pi502 compose ps'
} else {
echo 'skip'
}
}
}
}
}
}