【问题标题】:With powershell a Gitlab-ci job passed while failure occured使用 powershell 在发生故障时通过了 Gitlab-ci 作业
【发布时间】:2021-10-28 11:16:30
【问题描述】:

我的 gitlab-ci.yml 包含以下 Lint 代码

stages:
  - build

build:
  stage: build
  script:
  - exit 1

运行时,作业不会失败!

Running with gitlab-runner 13.10.0 (54944146)
Preparing the "shell" executor
Using Shell executor...
Preparing environment
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository
Checking out b70613dd
git-lfs/2.13.2 (GitHub; windows amd64; go 1.14.13; git fc664697)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:03
$ exit 1
Cleaning up file based variables
00:03
Job succeeded

当作业失败时如何避免错误的成功。

【问题讨论】:

  • 我找到了解决方案。问题出在 powershell shell 中。使用 powershell-core 时,问题不再出现。我还不明白为什么 powershell-5(windows 默认)返回错误的结果。
  • 很高兴你解决了它!我将撤回我的投票,因为这是一个与看起来略有不同的问题。顺便说一句,您可以发布自己问题的答案,这样如果您有兴趣,其他人就会知道这个特定问题有答案。

标签: powershell gitlab gitlab-ci


【解决方案1】:

PowerShell 5(Windows 默认 PS 实例)返回错误结果。使用 PowerShell Core 时,问题不再出现。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-09
    • 2019-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-30
    相关资源
    最近更新 更多