且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jenkins:当在Docker容器中进行Maven构建时,如何使用JUnit插件

更新时间:2023-09-30 08:03:10

您可以在junit之前创建一个临时容器,以提取测试结果文件以将测试结果复制到您的工厂.最后将其删除

You could create an temporary container just before junit to extract test results files to copy test result to your workspsace. And finally remove it

sh 'docker create --name temporary-container spring-image'
sh 'docker cp temporary-container:/var/www/java/target/surefire-reports .'
sh 'docker rm temporary-container'
junit 'surefire-reports'

您还可以查看 docker-pipeline 文档,该文档为您提供一些抽象来构建docker镜像

You could also take a look do docker-pipeline documentations which provides you some abstraction to build docker images