【发布时间】:2021-05-31 12:09:58
【问题描述】:
我正在 docker 中进行多阶段构建,以将应用程序与测试分开。现在在我的 Dockerfile 中的某个时间点运行:
RUN pytest --junit=test-reports/junit.xml
分别在我的 Jenkinsfile 中:
def app = docker.build("app:${BUILD_NUMBER}", "--target test .")
app.inside {
sh "cp -r /app/test-reports test-reports"
}
junit 'test-reports/junit.xml'
现在,如果我的测试失败,构建失败,这很好。但是该阶段的其余部分没有执行,即我无权访问 test-reports 文件夹。我该如何处理?
【问题讨论】:
标签: docker jenkins continuous-integration pytest docker-multi-stage-build