Skip to content

Commit 8ab66fa

Browse files
committed
Fix: remove duplicated diff and apply
Signed-off-by: Penghao <pewang@redhat.com>
1 parent 9160d31 commit 8ab66fa

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

prow.sh

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -833,16 +833,7 @@ install_snapshot_crds() {
833833
# $1: file path (optional) - if not provided, reads from stdin
834834
inject_vgs_feature_gate() {
835835
if [ "${CSI_PROW_ENABLE_GROUP_SNAPSHOT}" = "true" ]; then
836-
awk '
837-
BEGIN { inserted=0 }
838-
{
839-
print
840-
if ($0 ~ /--leader-election=true/ && !inserted) {
841-
print " - \"--feature-gates=CSIVolumeGroupSnapshot=true\""
842-
inserted=1
843-
}
844-
}
845-
'
836+
sed -E 's|^([[:space:]]*)# end snapshot controller args|\1- "--feature-gates=CSIVolumeGroupSnapshot=true"|'
846837
else
847838
cat # just pass the file through unchanged
848839
fi
@@ -929,31 +920,20 @@ install_snapshot_controller() {
929920
# NOTE: This logic is similar to the logic here:
930921
# https://github.com/kubernetes-csi/csi-driver-host-path/blob/v1.4.0/deploy/util/deploy-hostpath.sh#L155
931922
modified="$(replace_snapshot_controller_image "$yaml" "local-build" "$NEW_TAG" | inject_vgs_feature_gate)"
932-
diff <(echo "$yaml") <(echo "$modified")
933-
if ! echo "$modified" | kubectl apply -f -; then
934-
echo "modified version of ${SNAPSHOT_CONTROLLER_YAML}:"
935-
echo "$modified"
936-
exit 1
937-
fi
938923
elif [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then
939924
echo "Deploying snapshot-controller from ${SNAPSHOT_CONTROLLER_YAML} with canary images."
940925
modified="$(replace_snapshot_controller_image "$yaml" "canary" "" "${CSI_PROW_DRIVER_CANARY_REGISTRY}" | inject_vgs_feature_gate)"
941-
diff <(echo "$yaml") <(echo "$modified")
942-
if ! echo "$modified" | kubectl apply -f -; then
943-
echo "modified version of ${SNAPSHOT_CONTROLLER_YAML}:"
944-
echo "$modified"
945-
exit 1
946-
fi
947926
else
948927
echo "kubectl apply -f $SNAPSHOT_CONTROLLER_YAML"
949928
# Replace snapshot-controller container tag to make it consistent with CSI_SNAPSHOTTER_VERSION
950929
modified="$(replace_snapshot_controller_image "$yaml" "default" | inject_vgs_feature_gate)"
951-
diff <(echo "$yaml") <(echo "$modified")
952-
if ! echo "$modified" | kubectl apply -f -; then
953-
echo "modified version of ${SNAPSHOT_CONTROLLER_YAML}:"
954-
echo "$modified"
955-
exit 1
956-
fi
930+
fi
931+
932+
diff <(echo "$yaml") <(echo "$modified")
933+
if ! echo "$modified" | kubectl apply -f -; then
934+
echo "modified version of ${SNAPSHOT_CONTROLLER_YAML}:"
935+
echo "$modified"
936+
exit 1
957937
fi
958938

959939
cnt=0

0 commit comments

Comments
 (0)