mirror of
https://github.com/coreos/ignition.git
synced 2026-02-05 15:47:26 +01:00
I dont see mention of this change in the 1.23 changelog, however it is mentioned
in the commit c22865fcfa
fixes: #1931
38 lines
970 B
Bash
Executable File
38 lines
970 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
export GO111MODULE=on
|
|
|
|
NAME="ignition"
|
|
ORG_PATH="github.com/coreos"
|
|
REPO_PATH="${ORG_PATH}/${NAME}/v2"
|
|
GLDFLAGS=${GLDFLAGS:-}
|
|
export GOFLAGS=-mod=vendor
|
|
|
|
if [ -z ${VERSION+a} ]; then
|
|
VERSION=$(git describe --dirty --always)
|
|
echo "Using version from git: $VERSION"
|
|
fi
|
|
|
|
GLDFLAGS+="-X github.com/coreos/ignition/v2/internal/version.Raw=${VERSION}"
|
|
|
|
eval $(go env)
|
|
|
|
if [ -z ${BIN_PATH+a} ]; then
|
|
export BIN_PATH=${PWD}/bin/${GOARCH}
|
|
fi
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
echo "Building ${NAME}..."
|
|
# clean the cache since cgo isn't correctly handled by gocache. Test to see if this version
|
|
# of go supports caching before trying to clear the cache
|
|
go clean -help 2>&1 | grep -F '[-cache]' >/dev/null && go clean -cache -testcache
|
|
go build -buildmode=pie -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${NAME} ${REPO_PATH}/internal
|
|
|
|
NAME="ignition-validate"
|
|
|
|
echo "Building ${NAME}..."
|
|
go build -ldflags "${GLDFLAGS}" -o ${BIN_PATH}/${NAME} ${REPO_PATH}/validate
|