我在由Jenkins-Pipeline-Stage(Cloudbees-plugin)启动的Docker-Container中运行了一组API测试。
如果阶段(请参阅下文)失败,我想保存测试日志。
我试图在后期进行后续操作,但是之后我再也无法访问该图像。
您将如何解决这个问题?发生故障时如何保存图像?
stage('build Dockerimage and run API-tests') {
steps{
script {
def apitestimage = docker.build('apitestimage', '--no-cache=true dockerbuild')
apitestimage.inside('-p 5800:5800') {
dir('testing'){
sh 'ctest -V'
}
}
sh 'docker rmi --force apitestimage'
}
}
}
最佳答案
使用post { failure { .. } }
步骤直接在失败阶段内而不是以后将失败阶段的数据归档。
关于docker - 发生故障时如何从Cloudbees Pipeline中保存Docker卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45531819/