Skip to content

Commit

Permalink
add arm builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonskie authored and rkoster committed Jun 13, 2023
1 parent 0824757 commit 886d261
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
47 changes: 29 additions & 18 deletions ci/tasks/build-release/task
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
ROOT="${PWD}"
BUILDS_PATH="${ROOT}/builds"
BBL_VERSION="$(cat ${ROOT}/version/number)"
BBL_LINUX_BUILD_PATH="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_linux_x86-64"
BBL_LINUX_BUILD_PATH="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_linux"
BBL_OSX_BUILD_PATH="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_osx"
BBL_WINDOWS_BUILD_PATH="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_windows.exe"
BBL_WINDOWS_BUILD_PATH="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_windows_amd64.exe"
BUILD_PATH=""

function main() {
Expand All @@ -27,13 +27,19 @@ function main() {
rm -rf ./bosh/deployments/jumpbox-deployment/.git

for platform in "darwin" "windows" "linux"; do
# copy binaries
mv ${ROOT}/terraform-binaries/terraform_${platform}* ./terraform/binary_dist/terraform
create_mod
pushd "bbl/" > /dev/null
determine_build_path ${platform}
build_bbl ${BUILD_PATH} ${platform}
popd > /dev/null
for arch in "amd64" "arm64"; do
if [[ ${platform} == "windows" && ${arch} == "arm64" ]]; then
continue
fi

# copy binaries
mv ${ROOT}/terraform-binaries/terraform_${platform}_${arch}* ./terraform/binary_dist/terraform
create_mod
pushd "bbl/" > /dev/null
determine_build_path ${platform} ${arch}
build_bbl ${BUILD_PATH} ${platform} ${arch}
popd > /dev/null
done
done
popd > /dev/null

Expand All @@ -49,12 +55,16 @@ function main() {

echo "- Includes terraform binaries from ${TF_URL}" >> body

linux_sha=$(shasum -a 256 "${BBL_LINUX_BUILD_PATH}" | cut -d ' ' -f 1)
osx_sha=$(shasum -a 256 "${BBL_OSX_BUILD_PATH}" | cut -d ' ' -f 1)
for arch in "amd64" "arm64"; do
linux_sha=$(shasum -a 256 "${BBL_LINUX_BUILD_PATH}_${arch}" | cut -d ' ' -f 1)
osx_sha=$(shasum -a 256 "${BBL_OSX_BUILD_PATH}_${arch}" | cut -d ' ' -f 1)

echo "- *Linux_${arch} sha256: \`${linux_sha}\`*" >> body
echo "- *OSX_${arch} sha256: \`${osx_sha}\`*" >> body
done

windows_sha=$(shasum -a 256 "${BBL_WINDOWS_BUILD_PATH}" | cut -d ' ' -f 1)

echo "- *Linux sha256: \`${linux_sha}\`*" >> body
echo "- *OSX sha256: \`${osx_sha}\`*" >> body
echo "- *Windows sha256: \`${windows_sha}\`*" >> body
echo "*Known Issues:* Windows support is incomplete." >> body
popd > /dev/null
Expand All @@ -66,8 +76,8 @@ function build_bbl() {
local build_path
build_path="$1"

echo "Building amd64 for $2"
CGO_ENABLED=0 GOARCH="amd64" GOOS="$2" \
echo "Building $3 for $2"
CGO_ENABLED=0 GOARCH="$3" GOOS="$2" \
go build \
-ldflags "-X main.Version=${BBL_VERSION}" \
-o "${build_path}" .
Expand All @@ -77,13 +87,14 @@ function determine_build_path() {
local platform
local build_path
platform=$1
arch=$2
build_path="${BUILDS_PATH}/bin/bbl-v${BBL_VERSION}_"
if [[ $platform == "darwin" ]]; then
build_path+="osx"
build_path+="osx_${arch}"
elif [[ $platform == "linux" ]]; then
build_path+="linux_x86-64"
build_path+="linux_${arch}"
elif [[ $platform == "windows" ]]; then
build_path+="windows.exe"
build_path+="windows_${arch}.exe"
fi

BUILD_PATH="${build_path}"
Expand Down
15 changes: 10 additions & 5 deletions ci/tasks/download-terraform/task
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function download_terraform() {
local zip_name

platform=${1}
zip_name="terraform_${TF_VERSION}_${platform}_amd64.zip"
arch=${2}
zip_name="terraform_${TF_VERSION}_${platform}_${arch}.zip"

ZIP_URL="${URL_BASE}/${TF_VERSION}/${zip_name}"
wget ${ZIP_URL} -q
Expand All @@ -18,11 +19,15 @@ function download_terraform() {

pushd ${ROOT}/terraform-binaries > /dev/null
for platform in "darwin" "linux"; do
download_terraform ${platform}
mv terraform "terraform_${platform}"
for arch in "amd64" "arm64"; do
download_terraform ${platform} ${arch}
mv terraform "terraform_${platform}_${arch}"
done
done
for platform in "windows"; do
download_terraform ${platform}
mv terraform.exe "terraform_${platform}.exe"
for arch in "amd64"; do
download_terraform ${platform} ${arch}
mv terraform.exe "terraform_${platform}_${arch}.exe"
done
done
popd > /dev/null

0 comments on commit 886d261

Please sign in to comment.