make a jenkinsfile
This commit is contained in:
parent
0a2d7314b6
commit
e79ea8040e
|
@ -1,33 +1,40 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent {
|
||||||
|
label 'agent1-pi501'
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage("verify tooling") {
|
||||||
steps {
|
steps {
|
||||||
echo 'Building from Docker Compose...'
|
sh '''
|
||||||
step(
|
docker version
|
||||||
[
|
docker info
|
||||||
$class: 'DockerBuilderPublisher',
|
docker compose version
|
||||||
cleanImages: false,
|
'''
|
||||||
cleanupWithJenkinsJobDelete: false,
|
|
||||||
cloud: '',
|
|
||||||
dockerFileDirectory: '',
|
|
||||||
fromRegistry: [url: 'docker-registry1.in.thelinuxpro.net:5000'],
|
|
||||||
pushCredentialsId: '',
|
|
||||||
pushOnSuccess: false,
|
|
||||||
tagsString: ''
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push to Registry') {
|
|
||||||
|
stage("Build Containers and push to registry") {
|
||||||
|
sh 'docker compose build --push'
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Start primary container') {
|
||||||
steps {
|
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 {
|
steps {
|
||||||
echo 'Deploying....'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue