Skip to content

Commit f99f2a7

Browse files
authored
Allow sourcing local lxd-ci helper script and setting helm chart version in k8s.sh (#175)
2 parents ff957fd + 4a2cf4d commit f99f2a7

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

  • .github/actions/setup-k8s

.github/actions/setup-k8s/k8s.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
set -euo pipefail
1515

1616
# Source bin/helpers from canonical/lxd-ci repository.
17-
# shellcheck source=/dev/null
18-
source <(
19-
curl -fsSL https://raw.githubusercontent.com/canonical/lxd-ci/refs/heads/main/bin/helpers \
20-
|| { echo "Error: Failed to source bin/helpers from canonical/lxd-ci" >&2; exit 1; }
21-
)
17+
# LXD_CI_HELPERS_PATH can be set to a local path to skip the network fetch.
18+
if [ -n "${LXD_CI_HELPERS_PATH:-}" ]; then
19+
source "${LXD_CI_HELPERS_PATH}"
20+
else
21+
# shellcheck source=/dev/null
22+
source <(
23+
curl -fsSL https://raw.githubusercontent.com/canonical/lxd-ci/refs/heads/main/bin/helpers \
24+
|| { echo "Error: Failed to source bin/helpers from canonical/lxd-ci" >&2; exit 1; }
25+
)
26+
fi
2227

2328
# Script dir where the script is located.
2429
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
@@ -527,9 +532,12 @@ installLXDCSIDriver() {
527532
k8sImportImageTarball "${imagePath}"
528533
fi
529534

535+
local chartVersion=()
530536
if [ "${K8S_CSI_IMAGE_TAG}" = "dev" ]; then
531537
# Use local chart from repository.
532538
chartRepo="${ROOT_DIR}/charts"
539+
else
540+
chartVersion=(--version "${K8S_CSI_IMAGE_TAG}")
533541
fi
534542

535543
helm install lxd-csi "${chartRepo}" \
@@ -539,7 +547,8 @@ installLXDCSIDriver() {
539547
--wait \
540548
--debug \
541549
--set driver.image.tag="${K8S_CSI_IMAGE_TAG}" \
542-
--set snapshotter.enabled=true
550+
--set snapshotter.enabled=true \
551+
"${chartVersion[@]}"
543552
}
544553

545554
# help prints the usage information for this script.

0 commit comments

Comments
 (0)