From 377006dc60045be0a75f901bf95a2f86edf0c1a2 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 2 Oct 2024 23:19:28 +1000 Subject: [PATCH] Fix: if condition to check file ext Fix condition to check the file extension with packer build script. The packer init steps gets skipped when the condition fails with some filenames ex: mininet-ovs-2.8.pkr.hcl. Issue: RELENG-5574 Change-Id: I91b3b6270c62ee3a2c8f28c25be22b408657d840 Signed-off-by: Anil Belur --- releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml | 5 +++++ shell/packer-build.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml diff --git a/releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml b/releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml new file mode 100644 index 00000000..0e6a738e --- /dev/null +++ b/releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix condition that check the file extension with packer build script. + The condition is skipped when long names ex: mininet-ovs-2.8.pkr.hcl diff --git a/shell/packer-build.sh b/shell/packer-build.sh index 7dd2434b..3f58021f 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -53,7 +53,7 @@ export PACKER_LOG="yes" export PACKER_LOG_PATH="$PACKER_BUILD_LOG" # download plugins only for HCL format -if [[ "${template_file#*.}" == "pkr.hcl" ]]; then +if [[ "${template_file#*.}" =~ .*pkr.hcl ]]; then echo "packer init ${template_file} ..." packer.io init "${template_file}" fi -- 2.16.6