【问题标题】:How to save Docker volume from within Cloudbees Pipeline in case of fail万一发生故障,如何从 Cloudbees Pipeline 中保存 Docker 卷
【发布时间】:2017-08-15 07:15:16
【问题描述】:

我在由 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'
        }
      }
    }

【问题讨论】:

  • 每个问题一个问题。

标签: docker jenkins jenkins-pipeline cloudbees


【解决方案1】:

使用post { failure { .. } } 步骤将失败阶段的数据直接存档在失败阶段内,而不是稍后。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-14
    • 2016-05-17
    • 1970-01-01
    • 2020-12-02
    • 2017-09-06
    • 1970-01-01
    • 2023-03-24
    • 2017-03-22
    相关资源
    最近更新 更多