check / check (push) Failing after 3s
The Makefile exported DOCKER_HOST pointing at one private machine, so every docker call made through make, `make lint` and `make check` included, failed everywhere else. The line is gone: docker uses the local daemon, or a DOCKER_HOST set in the environment. `make build` now calls the new `script/build`, which stamps the version and commit as the Makefile did. A VERSION set in the environment now wins over `git describe`, not only one given as `make build VERSION=x`. build, clean, install and docker-run are phony; install depends on build. The vet target is removed: `script/test` runs `go vet` first. Model: opus-5-5
30 lines
1.0 KiB
Python
Executable File
30 lines
1.0 KiB
Python
Executable File
#!/bin/sh
|
|
# script/build: build the `secret` binary into the repo root, with its
|
|
# version and git commit stamped in (`secret info` shows both).
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
# CGO is required (Makefile exports this too)
|
|
export CGO_ENABLED=1
|
|
# A VERSION set in the environment wins (`make build VERSION=x`, as
|
|
# the Dockerfile does); otherwise `git describe` of this checkout.
|
|
version="${VERSION:-}"
|
|
if [ -z "$version" ]; then
|
|
version="$(git describe --tags --always --dirty 2>/dev/null ||
|
|
echo dev)"
|
|
fi
|
|
commit="$(git rev-parse HEAD 2>/dev/null || echo unknown)"
|
|
pkg=git.eeqj.de/sneak/secret/internal/cli
|
|
# Build the file, not the package `./cmd/secret`: a package build
|
|
# also stamps git status into the binary and fails where git cannot
|
|
# read the checkout, instead of falling back to `dev`/`unknown`.
|
|
go build -v \
|
|
-ldflags "-X '$pkg.Version=$version' -X '$pkg.GitCommit=$commit'" \
|
|
-o secret cmd/secret/main.go
|
|
}
|
|
|
|
main "$@"
|