From e79ea8040eb6feb29326180f3f2839b9f8366c62 Mon Sep 17 00:00:00 2001 From: Kameron Kenny - pi501 Date: Mon, 22 Apr 2024 21:35:26 -0400 Subject: [PATCH] make a jenkinsfile --- Jenkinsfile | 69 +++++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index aab1ac2..74c7f39 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,34 +1,41 @@ pipeline { - agent any + agent { + label 'agent1-pi501' + } - stages { - stage('Build') { - steps { - echo 'Building from Docker Compose...' - step( - [ - $class: 'DockerBuilderPublisher', - cleanImages: false, - cleanupWithJenkinsJobDelete: false, - cloud: '', - dockerFileDirectory: '', - fromRegistry: [url: 'docker-registry1.in.thelinuxpro.net:5000'], - pushCredentialsId: '', - pushOnSuccess: false, - tagsString: '' - ] - ) - } - } - stage('Push to Registry') { - steps { - echo('docker push [disabled]') - } - } - stage('Deploy') { - steps { - echo 'Deploying....' - } - } - } + stages { + stage("verify tooling") { + steps { + sh ''' + docker version + docker info + docker compose version + ''' + } + } + + stage("Build Containers and push to registry") { + sh 'docker compose build --push' + } + + stage('Start primary container') { + steps { + sh ''' + if [[ $(docker compose ps | wc -l) -eq 1 ]]; then + docker compose up -d --no-color primary + else + docker compose down primary + docker compose up -d --no-color primary + fi + ''' + sh 'docker compose ps' + } + } + + stage('Run tests against the container') { + steps { + + } + } + } }