1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

パイプラインで失敗しているはずなのにパイプラインが成功してしまう

Posted at

はじめに

パイプラインを動かしたところなぜか失敗しているのにその先に進んでしまう問題が起きたのでまとめます

問題

以下のようなパイプラインがありました

pipleine.yml
      - label: "Run unit test"
        command:
          - cd test
          - npm install
          - npm run typecheck && lint
          - npm run test

しかし今パイプラインで型チェックでエラーが出るようなコードを対象に動かしてもなぜか落ちずに最後のテストまで実行されてしまいました

解決方法

pipleine.yml
      - label: "Run unit test"
        command:
          - cd test
          - npm install
          - npm run typecheck
          - npm run lint
          - npm run test

&&としていたところを分けることでうまく行くようになりました
原因はよくわからないのでChatGPTにきいたところ

通常、パイプライン内のすべてのコマンドが終了コード 0 を返す限り、パイプラインは成功とみなされます。つまり、2つのコマンドが連鎖されている場合、最初のコマンドが失敗しても、2番目のコマンドが実行され、その終了コードがパイプラインの結果に影響しない場合があります。

おそらくそんな感じの挙動なんだろうなとは思いましたが、根本的な原因をさぐらずここで解決としました

おわりに

やっとカイゼンできたのでよかったです

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?