Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions atlas/templates/Makefile.common.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GENERATOR ?= $(DOCKER_RUNNER) $(DOCKER_GENERATOR)
export GOFLAGS ?= -mod=vendor
GO_CACHE ?= -pkgdir $(BUILD_PATH)/go-cache
GO_BUILD_FLAGS ?= $(GO_CACHE) -i -v
GO_TEST_FLAGS ?= -v -cover
GO_TEST_FLAGS ?= -v -cover
GO_PACKAGES ?= $(shell go list ./... | grep -v vendor)


Expand Down Expand Up @@ -78,7 +78,9 @@ push-atlas: docker
ifndef IMAGE_REGISTRY
@(echo "Please set IMAGE_REGISTRY variable in Makefile.vars to use push command"; exit 1)
else
@docker push $(SERVER_IMAGE):$(IMAGE_VERSION)
# Verify no changes locally prior to pushing image
git diff --exit-code
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not work as expected, because the flag file could be stale. The way this makefile was implemented doesn't check for a stale docker build context like basic docker build does.

If this section is removed, docker will ensure the image is based on the current context, which in turn will make the output of git diff --exit-code useful for matching the image to the commit.

.docker-$(IMAGE_NAME)-$(IMAGE_VERSION):
$(MAKE) docker-atlas
touch $@
.PHONY: docker
docker: .docker-$(IMAGE_NAME)-$(IMAGE_VERSION)

docker push $(SERVER_IMAGE):$(IMAGE_VERSION)
endif

.push-$(IMAGE_NAME)-$(IMAGE_VERSION):
Expand Down