From ad58364186d2efd8a391edca601cb18c36a147b6 Mon Sep 17 00:00:00 2001 From: whs Date: Wed, 14 May 2025 14:39:49 +0800 Subject: [PATCH 1/2] Fix kubectl diff by disable errexit; Which cause the script to exit after diff. Exit status 1 means difference were found. --- src/std/fwlib/blockTypes/kubectl.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/std/fwlib/blockTypes/kubectl.nix b/src/std/fwlib/blockTypes/kubectl.nix index 1e460688..7f5f3fe1 100644 --- a/src/std/fwlib/blockTypes/kubectl.nix +++ b/src/std/fwlib/blockTypes/kubectl.nix @@ -151,11 +151,13 @@ in export KUBECTL_EXTERNAL_DIFF diff() { + set +o errexit kubectl diff --server-side=true --field-manager="std-action-$(whoami)" ${ if usesKustomize then "--kustomize" else "--recursive --filename" } "$manifest_path/"; + set -o errexit return $?; } From e0392627fe2a9bd718791f0cb413da4dbbdafbc7 Mon Sep 17 00:00:00 2001 From: whs Date: Fri, 16 May 2025 08:55:35 +0800 Subject: [PATCH 2/2] Move to a better location --- src/std/fwlib/blockTypes/kubectl.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/std/fwlib/blockTypes/kubectl.nix b/src/std/fwlib/blockTypes/kubectl.nix index 7f5f3fe1..ddc7d42f 100644 --- a/src/std/fwlib/blockTypes/kubectl.nix +++ b/src/std/fwlib/blockTypes/kubectl.nix @@ -151,13 +151,11 @@ in export KUBECTL_EXTERNAL_DIFF diff() { - set +o errexit kubectl diff --server-side=true --field-manager="std-action-$(whoami)" ${ if usesKustomize then "--kustomize" else "--recursive --filename" } "$manifest_path/"; - set -o errexit return $?; } @@ -170,8 +168,10 @@ in } "$manifest_path/"; } + set +o errexit diff ret=$? + set -o errexit if [[ $ret == 0 ]] || [[ $ret == 1 ]]; then ${askUserToProceedSnippet "apply" "run"} fi