forked from docker-library/meta-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilds.sh
More file actions
executable file
·26 lines (21 loc) · 803 Bytes
/
builds.sh
File metadata and controls
executable file
·26 lines (21 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env bash
set -Eeuo pipefail
# TODO drop this from the defaults and set it explicitly in DOI instead (to prevent accidents)
: "${BASHBREW_STAGING_TEMPLATE:=oisupport/staging-ARCH:BUILD}"
export BASHBREW_STAGING_TEMPLATE
# put the binary in the directory of a symlink of "builds.sh" (used for testing coverage; see GOCOVERDIR below)
dir="$(dirname "$BASH_SOURCE")"
dir="$(readlink -ve "$dir")"
bin="$dir/bin/builds"
# but run the script/build from the directory of the *actual* "builds.sh" script
dir="$(readlink -ve "$BASH_SOURCE")"
dir="$(dirname "$dir")"
if ( cd "$dir" && ./.any-go-nt.sh "$bin" ); then
{
echo "building '$bin'"
"$dir/.go-env.sh" go build ${GOCOVERDIR:+-coverpkg=./...} -v -trimpath -o "$bin" ./cmd/builds
ls -l "$bin"
} >&2
fi
[ -x "$bin" ]
"$bin" "$@" | jq .