Move reverse-proxy to jenkins and config upgrade
This commit is contained in:
49
Jenkinsfile
vendored
Executable file
49
Jenkinsfile
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
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."
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user