Fix dev workflow hanging and implement runtime branch detection
- Fix duplicate Dockerfile sections that were causing build hangs - Replace complex build args with simple runtime git branch detection - Revert CI workflows to working state (remove build args and debug code) - Add automatic version tagging: dev branch shows "0.2.15-dev" - Enhanced movie fallback logic for rename-first scenarios - Improved logging to trace movie date decision process
This commit is contained in:
+16
-6
@@ -781,12 +781,22 @@ try:
|
||||
except:
|
||||
version = "0.1.0"
|
||||
|
||||
# Check if running in dev environment (set during Docker build)
|
||||
build_type = os.environ.get('BUILD_TYPE', 'production')
|
||||
image_tag = os.environ.get('IMAGE_TAG', 'latest')
|
||||
|
||||
if (build_type == 'dev' or 'dev' in image_tag.lower()):
|
||||
version = f"{version}-dev"
|
||||
# Check if running from dev branch (detect at runtime)
|
||||
try:
|
||||
# Try to read git branch from .git/HEAD
|
||||
git_head_path = Path(__file__).parent / ".git" / "HEAD"
|
||||
if git_head_path.exists():
|
||||
head_content = git_head_path.read_text().strip()
|
||||
if "ref: refs/heads/dev" in head_content:
|
||||
version = f"{version}-dev"
|
||||
elif head_content.startswith("ref: refs/heads/"):
|
||||
# Extract branch name for other branches
|
||||
branch = head_content.split("refs/heads/")[-1]
|
||||
if branch != "main":
|
||||
version = f"{version}-{branch}"
|
||||
except Exception:
|
||||
# If git detection fails, that's fine - use base version
|
||||
pass
|
||||
|
||||
app = FastAPI(
|
||||
title="NFOGuard",
|
||||
|
||||
Reference in New Issue
Block a user