Skip to content

Commit

Permalink
change the agent's image and packages for ARM platform (#2814)
Browse files Browse the repository at this point in the history
* change the agent's image for ARM

* add the instanceType option

* change instanceType to t4g.xlarge

* define OS type and architecture

* change the logic of defining the OS type

* change the logic of defining the OS type

* change the logic of defining the OS type

* chagnge instanceType add fix for Terraform installation and refactor common script

* change the instanceType for ARM

* Update .buildkite/scripts/common.sh

Co-authored-by: Mario Rodriguez Molins <[email protected]>

* Update .buildkite/scripts/common.sh

Co-authored-by: Mario Rodriguez Molins <[email protected]>

* Update .buildkite/scripts/common.sh

Co-authored-by: Mario Rodriguez Molins <[email protected]>

* fix remarks

* revert the instance type

---------

Co-authored-by: Mario Rodriguez Molins <[email protected]>
  • Loading branch information
sharbuz and mrodm authored Jul 25, 2023
1 parent 5cce568 commit 586c96d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .buildkite/pipeline.package.mbp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ steps:
command: ".buildkite/scripts/package.sh {{matrix.type}}"
agents:
provider: "aws"
image: "${IMAGE_UBUNTU_ARM_64}"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.medium"
matrix:
setup:
type:
Expand Down
29 changes: 26 additions & 3 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ set -euo pipefail
WORKSPACE="$(pwd)/bin"
TMP_FOLDER_TEMPLATE_BASE="tmp.fleet-server"
REPO="fleet-server"
platform_type="$(uname)"
platform_type_lowercase="${platform_type,,}"
hw_type="$(uname -m)"

check_platform_architeture() {
# for downloading the GVM and Terraform packages
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_workspace() {
if [[ ! -d "${WORKSPACE}" ]]; then
Expand All @@ -21,7 +42,8 @@ add_bin_path() {
with_go() {
echo "Setting up the Go environment..."
create_workspace
retry 5 curl -sL -o ${WORKSPACE}/gvm "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-linux-amd64"
check_platform_architeture
retry 5 curl -sL -o ${WORKSPACE}/gvm "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-${platform_type_lowercase}-${arch_type}"
chmod +x ${WORKSPACE}/gvm
eval "$(gvm $(cat .go-version))"
go version
Expand All @@ -32,7 +54,7 @@ with_go() {
with_docker_compose() {
echo "Setting up the Docker-compose environment..."
create_workspace
retry 5 curl -SL -o ${WORKSPACE}/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64"
retry 5 curl -sSL -o ${WORKSPACE}/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-${platform_type_lowercase}-${hw_type}"
chmod +x ${WORKSPACE}/docker-compose
docker-compose version
}
Expand Down Expand Up @@ -70,7 +92,8 @@ with_Terraform() {
echo "Setting up the Terraform environment..."
local path_to_file="${WORKSPACE}/terraform.zip"
create_workspace
retry 5 curl -SL -o ${path_to_file} "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
check_platform_architeture
retry 5 curl -sSL -o ${path_to_file} "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${platform_type_lowercase}_${arch_type}.zip"
unzip -q ${path_to_file} -d ${WORKSPACE}/
rm ${path_to_file}
chmod +x ${WORKSPACE}/terraform
Expand Down

0 comments on commit 586c96d

Please sign in to comment.