Skip to content

Commit

Permalink
[Buildkite] Update buildkite scripts (#1608)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm authored Dec 20, 2023
1 parent 42a15e6 commit a6799ce
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.test-with-integrations-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ env:
SETUP_GVM_VERSION: 'v0.5.1' # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151
LINUX_AGENT_IMAGE: "golang:${GO_VERSION}"
GH_CLI_VERSION: "2.29.0"
JQ_VERSION: "1.6"
JQ_VERSION: "1.7"

steps:
- label: ":go: Run check-static"
Expand Down
43 changes: 38 additions & 5 deletions .buildkite/scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ source .buildkite/scripts/tooling.sh

set -euo pipefail

platform_type="$(uname)"
hw_type="$(uname -m)"
platform_type_lowercase="${platform_type,,}"

check_platform_architecture() {
case "${hw_type}" in
"x86_64")
arch_type="amd64"
;;
"aarch64")
arch_type="arm64"
;;
"arm64")
arch_type="arm64"
;;
*)
echo "The current platform/OS type is unsupported yet"
;;
esac
}

create_bin_folder() {
mkdir -p "${WORKSPACE}/bin"
}
Expand All @@ -15,20 +36,26 @@ add_bin_path(){

with_kubernetes() {
create_bin_folder
retry 5 curl -sSLo "${WORKSPACE}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
check_platform_architecture

retry 5 curl -sSLo "${WORKSPACE}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-${platform_type_lowercase}-${arch_type}"
chmod +x "${WORKSPACE}/bin/kind"
kind version
which kind

retry 5 curl -sSLo "${WORKSPACE}/bin/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl"
retry 5 curl -sSLo "${WORKSPACE}/bin/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/${platform_type_lowercase}/${arch_type}/kubectl"
chmod +x "${WORKSPACE}/bin/kubectl"
kubectl version --client
which kubectl
}

with_go() {
create_bin_folder
retry 5 curl -sL -o "${WORKSPACE}/bin/gvm" "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-linux-amd64"
check_platform_architecture

echo "GVM ${SETUP_GVM_VERSION} (platform ${platform_type_lowercase} arch ${arch_type}"
retry 5 curl -sL -o "${WORKSPACE}/bin/gvm" "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-${platform_type_lowercase}-${arch_type}"

chmod +x "${WORKSPACE}/bin/gvm"
eval "$(gvm "$(cat .go-version)")"
go version
Expand All @@ -39,9 +66,11 @@ with_go() {

with_github_cli() {
create_bin_folder
check_platform_architecture

mkdir -p "${WORKSPACE}/tmp"

local gh_filename="gh_${GH_CLI_VERSION}_linux_amd64"
local gh_filename="gh_${GH_CLI_VERSION}_${platform_type_lowercase}_${arch_type}"
local gh_tar_file="${gh_filename}.tar.gz"
local gh_tar_full_path="${WORKSPACE}/tmp/${gh_tar_file}"

Expand All @@ -58,7 +87,11 @@ with_github_cli() {

with_jq() {
create_bin_folder
retry 5 curl -sL -o "${WORKSPACE}/bin/jq" "https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64"
check_platform_architecture
# filename for versions <=1.6 is jq-linux64
local binary="jq-${platform_type_lowercase}-${arch_type}"

retry 5 curl -sL -o "${WORKSPACE}/bin/jq" "https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/${binary}"

chmod +x "${WORKSPACE}/bin/jq"
jq --version
Expand Down

0 comments on commit a6799ce

Please sign in to comment.