From 09b8483ed67d3b85e983ef86c34260081975e1cb Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 2 May 2025 06:47:07 +0900 Subject: fix(blog/nuldoc): remove unnecessary "language" attribute --- .../2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd') diff --git a/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html b/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html index 8a8897f5..db6ea870 100644 --- a/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html +++ b/vhosts/blog/public/posts/2024-04-21/pipefail-option-in-gitlab-ci-cd/index.html @@ -86,7 +86,7 @@

例:

-
+
hello-world:
   stage: test
   image: alpine:latest
@@ -102,7 +102,7 @@
               

では、次のようなケースだとどうなるか。

-
+
hello-world:
   stage: test
   image: alpine:latest
@@ -121,7 +121,7 @@
               

前述したようなケースにおいて、途中で失敗したときに全体を失敗させるには、pipefail オプションを有効にする。

-
+
# On にする
 set -o pipefail
 # Off にする
@@ -137,7 +137,7 @@
             

次のような GitLab CI/CD ジョブが失敗してしまった。

-
+
hoge:
   stage: test
   image: alpine:latest
@@ -181,7 +181,7 @@
             

.gitlab-ci.yml で明示的には書いていないので、GitLab Runner (GitLab CI/CD のスクリプトを実行するプログラム) が勝手に追加しているに違いない。 そう仮説を立てて GitLab Runner のリポジトリ を調査したところ、 ソースコード中の以下の箇所set -o pipefail していることが判明した (コメントは筆者による)。

-
+
// pipefail オプションが存在しない環境にも対応するため、
 // 先に set -o でオプション一覧を表示させたあと、set -o pipefail している
 buf.WriteString("if set -o | grep pipefail > /dev/null; then set -o pipefail; fi; set -o errexit\n")
@@ -192,7 +192,7 @@

通常の Bash スクリプトを書く場合と同様に、pipefail が on になっていては困る場所だけ off にしてやればよい。

-
+
 hoge:
    stage: test
    image: alpine:latest
-- 
cgit v1.2.3-70-g09d2