即使测试失败,Gitlab runner也不会失败
我正在尝试为我的项目设置gitlab ci。 我的gitlab ci脚本如下所示:即使测试失败,Gitlab runner也不会失败,gitlab,gitlab-ci,xunit,gitlab-ci-runner,Gitlab,Gitlab Ci,Xunit,Gitlab Ci Runner,我正在尝试为我的项目设置gitlab ci。 我的gitlab ci脚本如下所示: stages: - build before_script: - docker info - chmod -R a+x scripts build: stage: build script: - pwd - ./scripts/ci-prepare.sh - ./scripts/dotnet-build.sh - ./scripts/dotnet-tests
stages:
- build
before_script:
- docker info
- chmod -R a+x scripts
build:
stage: build
script:
- pwd
- ./scripts/ci-prepare.sh
- ./scripts/dotnet-build.sh
- ./scripts/dotnet-tests.sh
- ./scripts/dotnet-publish.sh
- ./scripts/docker-publish-ci.sh
after_script:
- ./scripts/ci-success.sh
在生成日志中,我有以下信息:
测试总数:6。通过:5。失败:1。Ommited:0
但是事件测试失败,构建过程以成功退出代码完成。
为什么?
我没有配置allow_failure选项。Gitlab CI检查命令或脚本的退出代码,以确定它是否失败或成功 成功的命令返回一个0。所有其他退出代码均视为错误
我不知道您在测试中使用的是哪种软件-我认为您应该在脚本中返回测试的退出代码。我在bash脚本中添加了set-e,它工作正常。脚本的退出代码是什么?让他们返回任何0,ci知道它失败了set-e做什么?