From a5bc77d5926e5cd9963195ec8541ed03f61d9ac7 Mon Sep 17 00:00:00 2001 From: Greg Haskins Date: Thu, 30 Apr 2026 21:49:11 -0400 Subject: [PATCH] fix(knowledge): align build.py version with Makefile VERSION env var build.py was independently calling git describe, producing e.g. 'v1.3.5', while the Makefile TARGET used the externally-passed VERSION ('1.3.5' after stripping the v prefix). mvn deploy:deploy-file then failed because the file it expected did not exist. Pass VERSION through as MPE_VERSION env var so build.py uses the same version string as the Makefile TARGET, with git describe as the fallback for local builds where VERSION is not set. Signed-off-by: Greg Haskins --- knowledge/Makefile | 2 +- knowledge/build.py | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/knowledge/Makefile b/knowledge/Makefile index fefcc65..8879144 100644 --- a/knowledge/Makefile +++ b/knowledge/Makefile @@ -29,7 +29,7 @@ knowledge-build: $(VENV) ## Build the knowledge JAR echo "Model $(OLLAMA_MODEL) not present locally, pulling..."; \ curl -fsS $(OLLAMA_HOST)/api/pull -d '{"name":"$(OLLAMA_MODEL)","stream":false}' | tail -1; \ fi - OLLAMA_HOST=$(OLLAMA_HOST) MPE_OLLAMA_MODEL=$(OLLAMA_MODEL) $(PYTHON) knowledge/build.py + OLLAMA_HOST=$(OLLAMA_HOST) MPE_OLLAMA_MODEL=$(OLLAMA_MODEL) MPE_VERSION=$(VERSION) $(PYTHON) knowledge/build.py knowledge-install: knowledge-build ## Install JAR to ~/.m2 (for local iamlite dev) mvn install:install-file \ diff --git a/knowledge/build.py b/knowledge/build.py index aa1d4cc..68d6e1a 100644 --- a/knowledge/build.py +++ b/knowledge/build.py @@ -553,16 +553,19 @@ def run_assemble() -> Path: ) sys.exit(1) - # Determine version from git - try: - version = subprocess.check_output( - ["git", "describe", "--tags", "--always", "--dirty"], - cwd=Path(__file__).parent.parent, - stderr=subprocess.DEVNULL, - text=True, - ).strip() - except Exception: - version = "dev" + # Determine version: prefer MPE_VERSION env var (set by CI after stripping + # the 'v' prefix from the release tag) over git describe. + version = os.environ.get("MPE_VERSION") or "" + if not version: + try: + version = subprocess.check_output( + ["git", "describe", "--tags", "--always", "--dirty"], + cwd=Path(__file__).parent.parent, + stderr=subprocess.DEVNULL, + text=True, + ).strip() + except Exception: + version = "dev" # Get doc commit sha try: