From f27dd9c6e0f3a84a48cb3ee489a9ebbb5e43b4be Mon Sep 17 00:00:00 2001 From: Hugo Hromic Date: Sat, 29 Jul 2023 18:52:51 +0100 Subject: [PATCH 1/4] fix(dev): fix error in `make` when `cargo` is not installed Fixes the following error when using `make environment`: make: cargo: No such file or directory Signed-off-by: Hugo Hromic --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 150042c1c7f4f..66fe87cf489fd 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ export AWS_ACCESS_KEY_ID ?= "dummy" export AWS_SECRET_ACCESS_KEY ?= "dummy" # Set version -export VERSION ?= $(shell cargo vdev version) +export VERSION ?= $(shell command -v cargo >/dev/null && cargo vdev version || echo unknown) # Set if you are on the CI and actually want the things to happen. (Non-CI users should never set this.) export CI ?= false From 7efb9d24ea386c3e39203cec528def310f49d9b8 Mon Sep 17 00:00:00 2001 From: Hugo Hromic Date: Sun, 30 Jul 2023 13:22:32 +0100 Subject: [PATCH 2/4] fix(dev): fix `build` make target when `cargo` is not installed Fixes the following error when using `make build ENVIRONMENT=true`: Makefile:212: *** "Please install Rust: https://www.rust-lang.org/tools/install". Stop. Also switch to using `command` (POSIX compatible) instead of `which` for detecting `cargo`. Details in . Signed-off-by: Hugo Hromic --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 66fe87cf489fd..a1f5d2e8ed3db 100644 --- a/Makefile +++ b/Makefile @@ -208,9 +208,11 @@ build-graphql-schema: ## Generate the `schema.json` for Vector's GraphQL API .PHONY: check-build-tools check-build-tools: -ifeq (, $(shell which cargo)) +ifneq ($(ENVIRONMENT), true) +ifeq (, $(shell command -v cargo)) $(error "Please install Rust: https://www.rust-lang.org/tools/install") endif +endif ##@ Cross Compiling .PHONY: cross-enable From 508aeb982f48cf2cac0254409b01361e8560358c Mon Sep 17 00:00:00 2001 From: Hugo Hromic Date: Sun, 30 Jul 2023 14:12:47 +0100 Subject: [PATCH 3/4] fix(dev): fix detection of container tool in `make` Fixes the following error when `ENVIRONMENT=true` and neither Docker or Podman are available: make: podman: No such file or directory make: *** [Makefile:174: build] Error 127 Podman was being used as fallback even if also not available. A descriptive error is now reported instead in this situation. Signed-off-by: Hugo Hromic --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1f5d2e8ed3db..8ac4e4e5e6e7b 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,13 @@ export VERBOSE ?= false # Override the container tool. Tries docker first and then tries podman. export CONTAINER_TOOL ?= auto ifeq ($(CONTAINER_TOOL),auto) - override CONTAINER_TOOL = $(shell docker version >/dev/null 2>&1 && echo docker || echo podman) + ifeq ($(shell docker version >/dev/null 2>&1 && echo docker), docker) + override CONTAINER_TOOL = docker + else ifeq ($(shell podman version >/dev/null 2>&1 && echo podman), podman) + override CONTAINER_TOOL = podman + else + override CONTAINER_TOOL = unknown + endif endif # If we're using podman create pods else if we're using docker create networks. export CURRENT_DIR = $(shell pwd) @@ -128,6 +134,7 @@ define ENVIRONMENT_EXEC endef +ifneq ($(CONTAINER_TOOL), unknown) ifeq ($(ENVIRONMENT_AUTOBUILD), true) define ENVIRONMENT_PREPARE @echo "Building the environment. (ENVIRONMENT_AUTOBUILD=true) This may take a few minutes..." @@ -142,6 +149,11 @@ define ENVIRONMENT_PREPARE $(CONTAINER_TOOL) pull $(ENVIRONMENT_UPSTREAM) endef endif +else +define ENVIRONMENT_PREPARE +$(error "Please install a container tool such as Docker or Podman") +endef +endif .PHONY: check-container-tool check-container-tool: ## Checks what container tool is installed From 1a64561783483b730db8dd2c3534881420f0cf1a Mon Sep 17 00:00:00 2001 From: Hugo Hromic Date: Mon, 31 Jul 2023 19:41:38 +0100 Subject: [PATCH 4/4] chore: add `ifneq` Makefile keyword to spell checker allow-list Signed-off-by: Hugo Hromic --- .github/actions/spelling/allow.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt index 4ccce23a22e37..e94aea740924b 100644 --- a/.github/actions/spelling/allow.txt +++ b/.github/actions/spelling/allow.txt @@ -319,6 +319,7 @@ https humungus icecream ifeq +ifneq imobile influxd ionik