Skip to content

Commit

Permalink
CB-26218 Add linux arm64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajzathd committed Jun 20, 2024
1 parent b8613be commit 1a28443
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BINARY=salt-bootstrap

VERSION=0.13.6
VERSION=0.13.7
BUILD_TIME=$(shell date +%FT%T)
LDFLAGS=-ldflags "-X github.com/hortonworks/salt-bootstrap/saltboot.Version=${VERSION} -X github.com/hortonworks/salt-bootstrap/saltboot.BuildTime=${BUILD_TIME}"
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
Expand Down Expand Up @@ -41,7 +41,7 @@ vet:
test:
go test -timeout 30s -coverprofile coverage -race $$(go list ./... | grep -v /vendor/)

_build: build-darwin build-linux build-ppc64le
_build: build-darwin build-linux build-ppc64le build-linux-arm64

build: _check test _build

Expand All @@ -50,16 +50,18 @@ build-docker:
docker run --rm ${USER_NS} -v "${PWD}":/go/src/github.com/hortonworks/salt-bootstrap -w /go/src/github.com/hortonworks/salt-bootstrap -e VERSION=${VERSION} golang:1.14.3 make build

build-darwin:
GOOS=darwin go build -a -installsuffix cgo ${LDFLAGS} -o build/Darwin/${BINARY} main.go
GOOS=darwin go build -a -installsuffix cgo ${LDFLAGS} -o build/Darwin_x86_64/${BINARY} main.go

build-linux:
GOOS=linux go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux/${BINARY} main.go
GOOS=linux go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_x86_64/${BINARY} main.go

build-linux-arm64:
GOOS=linux GOARCH=arm64 go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_arm64/${BINARY} main.go

build-ppc64le:
GOOS=linux GOARCH=ppc64le go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux-ppc64le/${BINARY} main.go
GOOS=linux GOARCH=ppc64le go build -a -installsuffix cgo ${LDFLAGS} -o build/Linux_ppc64le/${BINARY} main.go

release: build-docker
rm -rf release
VERSION=${VERSION} BINARY=${BINARY} ./release.sh

docker_env_up:
Expand Down
10 changes: 4 additions & 6 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ set -x
rm -rf release
mkdir release

ARCH=$(uname -m)

declare -a Platforms=("Linux" "Darwin")
for platform in ${Platforms[@]}; do
declare -a Platforms=("Linux_x86_64" "Darwin_x86_64" "Linux_arm64")
for platform in "${Platforms[@]}"; do
if [ -d "./build/$platform" ]; then
echo "Compressing the ${platform} relevant binary ..."
tar -zcf "release/${BINARY}_${VERSION}_${platform}_${ARCH}.tgz" -C build/$platform $BINARY
tar -zcf "release/${BINARY}_${VERSION}_${platform}.tgz" -C build/$platform $BINARY
fi
done

echo "Creating release v${VERSION} from branch $BRANCH ..."

output=$(gh release list | grep ${VERSION})
if [ -z "$output" ]; then
gh release create "v${VERSION}" "./release/${BINARY}_${VERSION}_Linux_${ARCH}.tgz" "./release/${BINARY}_${VERSION}_Darwin_${ARCH}.tgz" -t ${VERSION} -n ""
gh release create "v${VERSION}" ./release/*.tgz -t ${VERSION} -n ""
else
echo "The cli release ${VERSION} already exists on the github."
fi

0 comments on commit 1a28443

Please sign in to comment.