Skip to content

Commit

Permalink
build: use explicit output path on build
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Vallejo <jakeev@amazon.com>
  • Loading branch information
jahkeup committed Aug 20, 2020
1 parent 87b633b commit abfd0c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dev/
*.tar*
bin/
vendor/
bottlerocket-update-operator
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ SHORT_SHA = $(shell git describe --abbrev=8 --always --dirty='-dev' --exclude '*
# image, it is appended to the IMAGE_NAME unless the name is specified.
IMAGE_ARCH_SUFFIX = $(addprefix -,$(ARCH))
# BUILDSYS_SDK_IMAGE is the Bottlerocket SDK image used for license scanning.
BUILDSYS_SDK_IMAGE ?= bottlerocket/sdk-x86_64:v0.10.1
BUILDSYS_SDK_IMAGE ?= bottlerocket/sdk-$(UNAME_ARCH):v0.10.1
# LICENSES_IMAGE_NAME is the name of the container image that has LICENSE files
# for distribution.
LICENSES_IMAGE = $(IMAGE_NAME)-licenses
# DESTDIR is where the release artifacts will be written.
DESTDIR = .
# DISTFILE is the path to the dist target's output file - the container image
# tarball.
DISTFILE = $(DESTDIR:/=)/$(subst /,_,$(IMAGE_NAME)).tar.gz
DISTFILE ?= $(patsubst %/,%,$(DESTDIR))/$(subst /,_,$(IMAGE_NAME)).tar.gz

# These values derive ARCH and DOCKER_ARCH which are needed by dependencies in
# image build defaulting to system's architecture when not specified.
Expand Down Expand Up @@ -58,16 +58,20 @@ all: build test container check

# Build the daemon and tools into GOBIN
build:
go install -v $(GOPKG)
go build -v -o $(GOBIN)/bottlerocket-update-operator .

# Run Go tests for daemon and tools.
#
# Tests run only with the native GOARCH of the system.
test: GOARCH=
test: GO_TEST_FLAGS += -v -x
# Use debuggable build to capture more logging for diagnosing failing tests.
test: GO_LDFLAGS +=-X $(GOPKG)/pkg/logging.DebugEnable=true
test:
go test -race -ldflags '$(GO_LDFLAGS)' $(GOPKGS)
go test $(GO_TEST_FLAGS) -ldflags '$(GO_LDFLAGS)' $(GOPKGS)

test-race: GO_TEST_FLAGS += -race
test-race: test

# Build a container image for daemon and tools.
container: licenses
Expand Down

0 comments on commit abfd0c2

Please sign in to comment.