#build-harness (2020-04)
Help with the Cloud Posse build-harness https://github.com/cloudposse/build-harness
2020-04-21
I’m stumped. I have a little make file:
GO ?= $(shell which go 2>/dev/null)
GOEXT_TMP_DIR := $(shell pwd -P)/tmp
.PHONY: test
test:
export GOPATH=$(GOEXT_TMP_DIR) && \
$(GO) get -u github.com/securego/gosec/cmd/gosec
This go get
command is supposed to get the source files for this gosec
tool, build it and install the binary to $GOPATH/bin. It works fine:
romulus:cicd-test cbarlock$ make -f test.mak
export GOPATH=/Users/cbarlock/vscode/cicd-test/tmp && \
/usr/local/go/bin/go get -u github.com/securego/gosec/cmd/gosec
romulus:cicd-test cbarlock$ ls tmp
bin src
romulus:cicd-test cbarlock$ ls tmp/bin
gosec
But when I run the same target as a build harness extension:
romulus:cicd-test cbarlock$ make test
export GOPATH=/Users/cbarlock/vscode/cicd-test/tmp && \
/usr/local/go/bin/go get -u github.com/securego/gosec/cmd/gosec
romulus:cicd-test cbarlock$ ls tmp
src
Only the source files are downloaded and the binary is not created. Any ideas why this is happening?
Are you actually using the build-harness-extensions
function? There’s a few things that can get confusing about paths and so on if you’re doing things like installing vendor executables and so on.
Yes. I didn’t do the work to hook our extensions to the build harness, but our stuff is “installed” in build-harness-extensions/modules/...
.
For this gosec
command, I am literally setting the GOPATH to a temp dir, downloading gosec
, running it and deleting it.