1

我正在使用 pipline 来构建和运行单元测试。

这是我的管道:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh '''
                  ./system/fuge/ci/docker-up.sh
                  ./system/fuge/ci/docker-down.sh
                '''
            }
        }

        stage('Test') {
            steps {
                sh '''
                 ./system/fuge/ci/docker-up-test.sh
               '''
            }
        }
}
        post {
        always {
            junit 'build/reports/**/*.xml'
          }
        }

}

我得到这个错误:

[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE

有谁知道是什么问题?

我也使用 node.js、lab.js 进行测试

4

1 回答 1

0

如果您在 docker 容器中运行测试,则可以通过将目录绑定挂载到主机(使用 docker-compose 卷)将它们恢复到主机。请注意,这可能会导致对文件的奇怪权限host) 或docker cp在容器内完成测试后运行,如下所示:

# make sure the directory exists on the host
mkdir -p build/reports

# make sure the directory we want to copy doesn't exist on the host
rm -rf build/reports/something

# copy directory from container to host
docker cp CONTAINER_NAME:build/reports/something build/reports/something
于 2017-08-20T13:08:05.240 回答