From fcf7efc289135e9b030c0b69d137f76932adc9d0 Mon Sep 17 00:00:00 2001 From: Yasser Sinjab <3217677+ysinjab@users.noreply.github.com> Date: Fri, 10 May 2024 14:12:13 +0300 Subject: [PATCH 1/2] Add support for kustomize to run on Linux ARM64 --- skylib/kustomize/kustomize.bzl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/skylib/kustomize/kustomize.bzl b/skylib/kustomize/kustomize.bzl index 7e2c5ee0..61980333 100644 --- a/skylib/kustomize/kustomize.bzl +++ b/skylib/kustomize/kustomize.bzl @@ -18,11 +18,16 @@ load("//skylib:stamp.bzl", "stamp") _binaries = { "darwin_amd64": ("https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.3/kustomize_v4.5.3_darwin_amd64.tar.gz", "b0a6b0568273d466abd7cd535c556e44aa9ff5f54c07e86ed9f3016b416de992"), "linux_amd64": ("https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.3/kustomize_v4.5.3_linux_amd64.tar.gz", "e4dc2f795235b03a2e6b12c3863c44abe81338c5c0054b29baf27dcc734ae693"), + "linux_arm64": ("https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.3/kustomize_v4.5.3_linux_arm64.tar.gz", "97cf7d53214388b1ff2177a56404445f02d8afacb9421339c878c5ac2c8bc2c8"), } def _download_binary_impl(ctx): if ctx.os.name == "linux": - platform = "linux_amd64" + current_architecture = ctx.execute(["uname", "-m"]).stdout.strip() + if current_architecture == "aarch64": + platform = "linux_arm64" + else: + platform = "linux_amd64" elif ctx.os.name == "mac os x": platform = "darwin_amd64" else: @@ -40,7 +45,7 @@ sh_binary( ctx.download_and_extract(filename, "bin/", sha256 = sha256) _download_binary = repository_rule( - _download_binary_impl, + implementation = _download_binary_impl, ) def kustomize_setup(name): From aa5d07babcff6ada8efe171795a1d304aebfd33a Mon Sep 17 00:00:00 2001 From: Yasser Sinjab <3217677+ysinjab@users.noreply.github.com> Date: Fri, 10 May 2024 14:18:21 +0300 Subject: [PATCH 2/2] remove implementation argument --- skylib/kustomize/kustomize.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skylib/kustomize/kustomize.bzl b/skylib/kustomize/kustomize.bzl index 61980333..a6f13b75 100644 --- a/skylib/kustomize/kustomize.bzl +++ b/skylib/kustomize/kustomize.bzl @@ -45,7 +45,7 @@ sh_binary( ctx.download_and_extract(filename, "bin/", sha256 = sha256) _download_binary = repository_rule( - implementation = _download_binary_impl, + _download_binary_impl, ) def kustomize_setup(name):