Skip to content

Commit fb34532

Browse files
committed
fix(blockTypes/kubectl): polish off the kubectl block type
1 parent f0a9a55 commit fb34532

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

src/std/fwlib/blockTypes/kubectl.nix

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ in
6262
echo
6363
rm -rf "$manifest_path"
6464
mkdir -p "$manifest_path"
65-
ln -sf "${manifestsWithGitRevision target}" "$manifest_path"
65+
ln -s "${manifestsWithGitRevision target}"/* "$manifest_path"
6666
echo
6767
echo "Manifests built in: $manifest_path"
6868
}
@@ -77,35 +77,33 @@ in
7777
${render}
7878
render
7979
'' {})
80-
(mkCommand currentSystem "apply" "Apply the manifests to K8s" [pkgs.kubectl pkgs.jq] ''
80+
(mkCommand currentSystem "diff" "Diff the manifests against the cluster" [pkgs.kubectl] ''
8181
${render}
8282
render
8383
8484
diff() {
85-
if ! [[ -v CI ]]; then
86-
kubectl diff --server-side=true --field-manager="std-action-in-ci" \
87-
--filename "$manifest_path" --recursive;
88-
else
89-
kubectl diff --server-side=true --field-manager="std-action-$(whoami)" \
90-
--filename "$manifest_path" --recursive;
91-
fi
85+
kubectl diff --server-side=true --field-manager="std-action-$(whoami)" \
86+
--filename "$manifest_path" --recursive;
87+
}
88+
89+
diff
90+
'' {})
91+
(mkCommand currentSystem "apply" "Apply the manifests to K8s" [pkgs.kubectl] ''
92+
${render}
93+
render
94+
95+
diff() {
96+
kubectl diff --server-side=true --field-manager="std-action-$(whoami)" \
97+
--filename "$manifest_path" --recursive;
9298
}
9399
94100
run() {
95-
if ! [[ -v CI ]]; then
96-
kubectl apply --server-side=true --field-manager="std-action-in-ci" \
97-
--filename "$manifest_path" --recursive;
98-
else
99-
kubectl apply --server-side=true --field-manager="std-action-$(whoami)" \
100-
--filename "$manifest_path" --recursive;
101-
fi
101+
kubectl apply --server-side=true --field-manager="std-action-$(whoami)" \
102+
--filename "$manifest_path" --recursive;
102103
}
103104
104-
if diff; then
105-
${askUserToProceedSnippet "apply" "run"}
106-
else
107-
echo "Deployment hasn't changed since last deployment, nothing to deploy"
108-
fi
105+
diff
106+
${askUserToProceedSnippet "apply" "run"}
109107
'' {})
110108
(mkCommand currentSystem "explore" "Interactively explore the manifests" [pkgs.fx] ''
111109
fx ${

src/std/fwlib/blockTypes/nomad.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ in
4848
render() {
4949
echo "Rendering to $job_path..."
5050
rm -rf "$job_path"
51-
ln -sf "${jobWithGitRevision target}" "$job_path"
51+
ln -s "${jobWithGitRevision target}" "$job_path"
5252
if status=$(nomad validate "$job_path"); then
5353
echo "$status for $job_path"
5454
fi

0 commit comments

Comments
 (0)