簡體   English   中英

(誤報)使用gitlab-ci運行docker-compose:構建作業失敗但管道成功

[英](False Positive) Running docker-compose with gitlab-ci: Build job fails but pipeline succeeds

我試圖讓gitlab-ci運行我的docker-compose文件來構建集成環境,運行測試,然后成功或失敗。

我的集成測試的dockerfile:

FROM maven:3.5.4-jdk-8
VOLUME /tmp
COPY / /tmp
WORKDIR /tmp
CMD mvn clean verify -P integration-test

Docker撰寫文件:

services:
  integration:
    build:
      context: ./
      dockerfile: docker/integration/Dockerfile
    container_name: app_integration
    restart: always

gitlab-ci.yml:

integration_tests:
  stage: test
  only:
    - branches
  script:
    - docker-compose -f docker-compose.integration-test.yml up --exit-code-from=integration --force-recreate

控制台輸出:

app_integration | [INFO] 
app_integration | [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
app_integration | [INFO] 
app_integration | [INFO] 
app_integration | [INFO] --- maven-failsafe-plugin:2.22.1:verify (integration-tests) @ app ---
app_integration | [INFO] ------------------------------------------------------------------------
app_integration | [INFO] BUILD FAILURE
app_integration | [INFO] ------------------------------------------------------------------------
app_integration | [INFO] Total time: 01:09 min
app_integration | [INFO] Finished at: 2018-10-22T17:53:33Z
app_integration | [INFO] ------------------------------------------------------------------------
app_integration | [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.1:verify (integration-tests) on project app: There are test failures.
app_integration | [ERROR] 
app_integration | [ERROR] Please refer to /tmp/target/failsafe-reports for the individual test results.
app_integration | [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
app_integration | [ERROR] -> [Help 1]
app_integration | [ERROR] 
app_integration | [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
app_integration | [ERROR] Re-run Maven using the -X switch to enable full debug logging.
app_integration | [ERROR] 
app_integration | [ERROR] For more information about the errors and possible solutions, please read the following articles:
app_integration | [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
app_integration exited with code 1
Stopping app_integration ... 

Stopping app_integration ... done
Aborting on container exit...
Job succeeded

現在,我正在運行一個測試,該測試運行一個assert false測試,並且應該會失敗。 但是,我無法使管道失敗,因為它是“應有的”。

問題是restart: always

我刪除了它,它開始按需工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM