如何在Gitlab CI Shell运行程序上失败构建

编程入门 行业动态 更新时间:2024-10-11 13:24:41
本文介绍了如何在Gitlab CI Shell运行程序上失败构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个在Windows 10上运行的Gitlab CI运行器:

I have a Gitlab CI runner running on windows 10:

before_script: - "echo off" - 'call "%VS120COMNTOOLS%\vsvars32.bat"' - echo. - set - echo. stages: - build build: stage: build script: - 'StatusTest.exe' #- msbuild...

我正在尝试使用StatusText.exe使构建失败(我尝试返回状态代码-1,0,1;引发异常等),但是Runner仅记录该异常并继续执行以下步骤.

I am trying to fail the build with StatusText.exe (I tried returning status codes -1,0,1; throwing an exception, etc.) But Runner only logs the exception and continues with following steps.

是什么决定CI Shell运行程序应该使构建失败而不进行下一步?

What determines that CI shell runner should fail the build and not proceed to next step?

输出:

... windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log $ echo. $ StatusTest.exe Unhandled Exception: System.Exception: tralala at StatusTest.Program.Main(String[] args) $ echo "Restoring NuGet Packages..." ...

推荐答案

是什么决定了CI Shell运行程序应该使构建失败而不是失败 进行下一步?

What determines that CI shell runner should fail the build and not proceed to next step?

1)什么时候应该失败

您需要在gitlab-ci.yml

- # .... - exit 1

阶段执行结果应该失败,并且不执行下一步:

The stage execution result should fail and does not go to the next step:

然后当您查看自己的舞台(在我的情况下是第3个舞台)时,结果将失败:

and then when you look at your stage (in my case the 3rd one) the result will be failed:

您需要在gitlab-ci.yml

- # .... - exit 0

阶段执行结果应为:

然后,当您查看自己的阶段(在我的情况下是第3个阶段)时,结果会确定,可以进入下一个阶段:

and then when you look at your stage (in my case the 3rd one) the result will be Ok and ready to go to the next stage:

更多推荐

如何在Gitlab CI Shell运行程序上失败构建

本文发布于:2023-11-25 13:04:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629866.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   如何在   CI   Gitlab   Shell

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!