This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
     new ad65ac9  Prepare scripts for arm64 / aarch64 support (#459)
ad65ac9 is described below

commit ad65ac9941f585c03da6ede33904ebc8aa5f45e5
Author: Lari Hotari <[email protected]>
AuthorDate: Thu Feb 15 09:49:15 2024 +0200

    Prepare scripts for arm64 / aarch64 support (#459)
    
    - GitHub Actions will be adding arm64 support soon
      
https://resources.github.com/devops/accelerate-your-cicd-with-arm-and-gpu-runners-in-github-actions/
---
 .github/actions/chart-testing-action/ct.sh | 19 ++++++++++++++-----
 hack/common.sh                             |  6 ++++--
 scripts/pulsar/common_auth.sh              | 18 +-----------------
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/.github/actions/chart-testing-action/ct.sh 
b/.github/actions/chart-testing-action/ct.sh
index 47741ef..04ce06c 100755
--- a/.github/actions/chart-testing-action/ct.sh
+++ b/.github/actions/chart-testing-action/ct.sh
@@ -39,6 +39,17 @@ DEFAULT_CHART_TESTING_VERSION=v3.10.1
 DEFAULT_YAMLLINT_VERSION=1.33.0
 DEFAULT_YAMALE_VERSION=4.0.4
 
+ARCH=$(uname -m)
+case $ARCH in
+    x86) ARCH="386";;
+    x86_64) ARCH="amd64";;
+    i686) ARCH="386";;
+    i386) ARCH="386";;
+    arm64) ARCH="arm64";;
+    aarch64) ARCH="arm64";;
+esac
+OS=$(uname|tr '[:upper:]' '[:lower:]')
+
 show_help() {
 cat << EOF
 Usage: $(basename "$0") <options>
@@ -109,16 +120,14 @@ install_chart_testing() {
         exit 1
     fi
 
-    local arch
-    arch=$(uname -m)
-    local cache_dir="$RUNNER_TOOL_CACHE/ct/$version/$arch"
+    local cache_dir="$RUNNER_TOOL_CACHE/ct/$version/${ARCH}"
     local venv_dir="$cache_dir/venv"
 
     if [[ ! -d "$cache_dir" ]]; then
         mkdir -p "$cache_dir"
 
         echo "Installing chart-testing..."
-        curl -sSLo ct.tar.gz 
"https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_linux_amd64.tar.gz";
+        curl -sSLo ct.tar.gz 
"https://github.com/helm/chart-testing/releases/download/$version/chart-testing_${version#v}_${OS}_${ARCH}.tar.gz";
         tar -xzf ct.tar.gz -C "$cache_dir"
         rm -f ct.tar.gz
 
@@ -150,4 +159,4 @@ install_chart_testing() {
     "$cache_dir/ct" version
 }
 
-main "$@"
+main "$@"
\ No newline at end of file
diff --git a/hack/common.sh b/hack/common.sh
index 15003ca..f7c8de9 100755
--- a/hack/common.sh
+++ b/hack/common.sh
@@ -47,11 +47,13 @@ hack::discoverArch() {
     x86_64) ARCH="amd64";;
     i686) ARCH="386";;
     i386) ARCH="386";;
+    arm64) ARCH="arm64";;
+    aarch64) ARCH="arm64";;
   esac
 }
 
 hack::discoverArch
-OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')
+OS=$(uname|tr '[:upper:]' '[:lower:]')
 
 function hack::verify_kubectl() {
     if test -x "$KUBECTL_BIN"; then
@@ -105,7 +107,7 @@ function hack::ensure_kind() {
     echo "Installing kind v$KIND_VERSION..."
     tmpfile=$(mktemp)
     trap "test -f $tmpfile && rm $tmpfile" RETURN
-    curl --retry 10 -L -o $tmpfile 
https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-$(uname)-amd64
+    curl --retry 10 -L -o $tmpfile 
https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-${OS}-${ARCH}
     mv $tmpfile $KIND_BIN
     chmod +x $KIND_BIN
 }
diff --git a/scripts/pulsar/common_auth.sh b/scripts/pulsar/common_auth.sh
index 9079322..bbca8c0 100755
--- a/scripts/pulsar/common_auth.sh
+++ b/scripts/pulsar/common_auth.sh
@@ -29,20 +29,6 @@ PULSARCTL_VERSION=v3.0.2.6
 PULSARCTL_BIN=${HOME}/.pulsarctl/pulsarctl
 export PATH=${HOME}/.pulsarctl/plugins:${PATH}
 
-discoverArch() {
-  ARCH=$(uname -m)
-  case $ARCH in
-    x86) ARCH="386";;
-    x86_64) ARCH="amd64";;
-    i686) ARCH="386";;
-    i386) ARCH="386";;
-    arm64) ARCH="arm64";;
-  esac
-}
-
-discoverArch
-OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')
-
 test -d "$OUTPUT_BIN" || mkdir -p "$OUTPUT_BIN"
 
 function pulsar::verify_pulsarctl() {
@@ -62,6 +48,4 @@ function pulsar::ensure_pulsarctl() {
     curl --retry 10 -L -o $install_script 
https://raw.githubusercontent.com/streamnative/pulsarctl/master/install.sh
     chmod +x $install_script
     $install_script --user --version ${PULSARCTL_VERSION}
-}
-
-
+}
\ No newline at end of file

Reply via email to