Skip to content

Commit

Permalink
fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
itaysk committed Feb 18, 2021
1 parent 24ea252 commit e5f25a7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Makefile
Expand Up @@ -16,7 +16,6 @@ CMD_TAR ?= tar
CMD_CP ?= cp

release_tools := $(CMD_DOCKER) $(CMD_GIT) $(CMD_CHECKSUM) $(CMD_GITHUB) $(CMD_TAR) $(CMP_CP)
check_release_tools := $(shell for tool in $(release_tools); do command -v $$tool >/dev/null || (echo "missing required tool $$tool" ; false); done)

# DOCKER variable is used by sub-makefiles to build their artifact in a container
export DOCKER
Expand Down Expand Up @@ -50,26 +49,33 @@ $(OUT_ARCHIVE) $(OUT_CHECKSUMS) &: $(RELEASE_FILES) | $(OUT_DIR)

.PHONY: docker
docker:
-rm -rf dist tracee-ebpf/dist tracee-rules/dist
$(CMD_DOCKER) build --build-arg VERSION=$(VERSION) -t $(OUT_DOCKER):latest .

.PHONY: docker-slim
docker-slim:
-rm -rf dist tracee-ebpf/dist tracee-rules/dist
$(CMD_DOCKER) build --build-arg VERSION=$(VERSION) -t $(OUT_DOCKER):slim --build-arg BASE=slim .

# release_docker_image accepts a docker image $1, pushes it as $2 to remote repository, and records it in the release notes
define release_docker_image
$(CMD_DOCKER) tag $(1) $(2) && $(CMD_DOCKER) push $(2) && echo '- `docker pull docker.io/$(2)`' >> $(release_notes);
endef

release_notes := $(OUT_DIR)/release-notes.txt
release_images_fat := $(PUSH_DOCKER_REPO):latest $(PUSH_DOCKER_REPO):$(PUSH_DOCKER_TAG)
release_images_slim := $(PUSH_DOCKER_REPO):slim $(PUSH_DOCKER_REPO):slim-$(PUSH_DOCKER_TAG)

.PHONY: release
# before running this rule, need to authenticate git, gh, and docker tools
release: $(OUT_ARCHIVE) $(OUT_CHECKSUMS) | docker docker-slim $(check_release_tools)
release:
test -n '$(RELEASE_TAG)' || (echo "missing required variable RELEASE_TAG" ; false)
set -e; for tool in "$(release_tools)"; do command -v $$tool >/dev/null || (echo "missing required tool $$tool" ; exit 1); done
-rm -rf dist tracee-ebpf/dist tracee-rules/dist
$(MAKE) docker docker-slim
-rm -rf dist tracee-ebpf/dist tracee-rules/dist
$(MAKE) release2

release_notes := $(OUT_DIR)/release-notes.txt
.PHONY: release2
# before running this rule, need to authenticate git, gh, and docker tools
release2: $(OUT_ARCHIVE) $(OUT_CHECKSUMS)
-rm $(release_notes)
echo '## Changelog' > $(release_notes)
$(CMD_GIT) log --pretty=oneline --abbrev=commit --no-decorate --no-color tags/$(shell $(CMD_GIT) describe --tags --abbrev=0)..HEAD >> $(release_notes)
Expand Down

0 comments on commit e5f25a7

Please sign in to comment.