Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Buildkite] Update buildkite scripts #1608

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,,}"
Comment on lines +7 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. It looks a bit unexpected to me to call platform_type to the operating system. And platform_type is never used, so maybe we can reserve this name to the final form that we use.

Suggested change
platform_type="$(uname)"
hw_type="$(uname -m)"
platform_type_lowercase="${platform_type,,}"
uname_os_type="$(uname)"
hardware_name="$(uname -m)"
os_type="${uname_os_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