49 lines
1.2 KiB
Groovy
49 lines
1.2 KiB
Groovy
pipeline {
|
|
agent any
|
|
|
|
stages {
|
|
stage('Check git...') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
stage('Build') {
|
|
steps {
|
|
echo "Build Caddy with cache plugin..."
|
|
sh "docker compose build --pull"
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
echo "Deploy new reverse proxy..."
|
|
sh "docker compose up -d"
|
|
}
|
|
}
|
|
stage('Check module...') {
|
|
steps {
|
|
script {
|
|
// Ask caddy to list modules
|
|
def modules = sh(script: "docker exec caddy-reverse-proxy caddy list-modules", returnStdout: true)
|
|
if (modules.contains('http.handlers.cache')) {
|
|
echo "Cache module activated"
|
|
} else {
|
|
error "Error : can't find cache module"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
echo "Clean unused image..."
|
|
sh "docker image prune -f"
|
|
}
|
|
success {
|
|
echo "Success !"
|
|
}
|
|
failure {
|
|
echo "Failed."
|
|
}
|
|
}
|
|
} |