mirror of
https://github.com/openshift/installer.git
synced 2026-02-06 00:48:45 +01:00
hack/release: Make it easy to cross-compile release binaries
And stick Git tagging in there too, because why not. This is mostly to get our list of target OSes and architectures into version control. The SKIP_GENERATION variable allows you to turn off vfsgen when we have GOOS and/or GOARCH set to values that will not run on your host ;). Also change --abbrev from 0 to 40 in the build script, because --abbrev=0 results in dropping the commit hash entirely when there's a past tag: $ git describe --always --abbrev=40 --dirty v0.1.0-2-gff5ee75e5010efb305d4bc381d944b14a4a97c3b-dirty $ git describe --always --abbrev=0 --dirty v0.1.0-dirty $ git describe --always --dirty v0.1.0-2-gff5ee75-dirty Checking on the tag itself for sanity: $ git checkout v0.1.0 $ git describe --always --abbrev=40 --dirty v0.1.0
This commit is contained in:
@@ -5,14 +5,18 @@ set -ex
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
MODE="${MODE:-release}"
|
||||
LDFLAGS="${LDFLAGS} -X main.version=$(git describe --always --abbrev=0 --dirty)"
|
||||
LDFLAGS="${LDFLAGS} -X main.version=$(git describe --always --abbrev=40 --dirty)"
|
||||
TAGS="${TAGS:-}"
|
||||
OUTPUT="${OUTPUT:-bin/openshift-install}"
|
||||
export CGO_ENABLED=0
|
||||
|
||||
case "${MODE}" in
|
||||
release)
|
||||
TAGS="${TAGS} release"
|
||||
go generate ./data
|
||||
if test "${SKIP_GENERATION}" != y
|
||||
then
|
||||
go generate ./data
|
||||
fi
|
||||
;;
|
||||
dev)
|
||||
;;
|
||||
@@ -26,4 +30,4 @@ then
|
||||
export CGO_ENABLED=1
|
||||
fi
|
||||
|
||||
go build -ldflags "${LDFLAGS}" -tags "${TAGS}" -o ./bin/openshift-install ./cmd/openshift-install
|
||||
go build -ldflags "${LDFLAGS}" -tags "${TAGS}" -o "${OUTPUT}" ./cmd/openshift-install
|
||||
|
||||
21
hack/release.sh
Executable file
21
hack/release.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Prepare for a release. Usage:
|
||||
#
|
||||
# $ hack/release.sh v0.1.0
|
||||
|
||||
set -ex
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
TAG="${1}"
|
||||
|
||||
./build.sh # ensure freshly-generated data
|
||||
for GOOS in darwin linux
|
||||
do
|
||||
GOARCH=amd64
|
||||
OUTPUT="bin/openshift-install-${GOOS}-${GOARCH}"
|
||||
GOOS="${GOOS}" GOARCH="${GOARCH}" OUTPUT="${OUTPUT}" SKIP_GENERATION=y ./build.sh
|
||||
done
|
||||
(cd ../bin && sha256sum openshift-install-*)
|
||||
git tag -sm "version ${TAG}" "${TAG}"
|
||||
Reference in New Issue
Block a user