如何在Cloudbees Pipeline中保存Docker卷,以防失败



我在Docker-Container中运行一组API测试,这些测试由Jenkins-Pipeline-Stage(Cloudbees-plugin(启动。

我想保存测试日志,以防阶段(见下文(失败。 我试图在后期阶段使用后期操作来执行此操作,但后来我无法再访问该图像。 你会如何处理这个问题?如果失败,如何保存图像?

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 { .. } }步骤将失败阶段的数据直接存档在失败阶段中,而不是稍后存档。

最新更新