make a jenkinsfile

This commit is contained in:
Kameron Kenny - pi501 2024-04-22 21:35:26 -04:00
parent 0a2d7314b6
commit e79ea8040e
1 changed files with 38 additions and 31 deletions

47
Jenkinsfile vendored
View File

@ -1,33 +1,40 @@
pipeline {
agent any
agent {
label 'agent1-pi501'
}
stages {
stage('Build') {
stage("verify tooling") {
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: ''
]
)
sh '''
docker version
docker info
docker compose version
'''
}
}
stage('Push to Registry') {
stage("Build Containers and push to registry") {
sh 'docker compose build --push'
}
stage('Start primary container') {
steps {
echo('docker push [disabled]')
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('Deploy') {
stage('Run tests against the container') {
steps {
echo 'Deploying....'
}
}
}