81 lines
1.7 KiB
Groovy
81 lines
1.7 KiB
Groovy
pipeline {
|
|
environment {
|
|
REGISTRY_URL = "https://proxy.docker.dataekb.ru/local_cache"
|
|
IMAGE_NAME = "open_sesam"
|
|
IMAGE_TAG = "latest"
|
|
}
|
|
|
|
agent { label 'agent_smith'}
|
|
|
|
stages {
|
|
|
|
stage ('push main') {
|
|
steps {
|
|
script {
|
|
docker.withRegistry("${REGISTRY_URL}", 'jenkins_harbor') {
|
|
def customImage = docker.build("proxy.docker.dataekb.ru/local_cache/${IMAGE_NAME}:latest")
|
|
customImage.push()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage ('clear after build and push') {
|
|
steps {
|
|
script {
|
|
sh "docker image prune --filter label=stage=builder"
|
|
}
|
|
}
|
|
}
|
|
|
|
stage("Deploy") {
|
|
steps {
|
|
script {
|
|
sh '''
|
|
docker-compose pull
|
|
docker-compose up -d
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
failure {
|
|
echo "[ERROR] Build failure"
|
|
}
|
|
success {
|
|
echo "[OK] Build success"
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Old_version
|
|
// pipeline {
|
|
// agent { label 'agent_smith' }
|
|
//
|
|
// stages {
|
|
// stage('Stop and Remove Existing Container') {
|
|
// steps {
|
|
// sh '''
|
|
// docker stop open_sesam || true
|
|
// docker rm open_sesam || true
|
|
// docker-compose down || true
|
|
// '''
|
|
// }
|
|
// }
|
|
//
|
|
// stage('Build and Run Container') {
|
|
// steps {
|
|
// sh '''
|
|
// docker-compose up --build -d
|
|
// '''
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|