From 2cdfd015704a8f545b023a1bc7dca3d544d8591b Mon Sep 17 00:00:00 2001 From: andrewm4894 Date: Sat, 23 Aug 2025 22:22:40 +0100 Subject: [PATCH 1/2] Remove version from dashboard header and fix commit hash tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove version display from dashboard header for cleaner UI - Keep /version endpoint for programmatic access - Fix "commit hash unknown" issue by capturing git hash during Docker builds - Update Dockerfile.fly to accept ANOMSTACK_BUILD_HASH build argument - Modify deployment script to pass git commit hash to Docker build - Update Makefile fly-build-test target to include git hash for local testing ๐Ÿค– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Makefile | 4 +++- dashboard/routes/index.py | 13 +------------ docker/Dockerfile.fly | 4 ++++ scripts/deployment/deploy_fly.sh | 18 ++++++++++++++++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index fd796de..be3bb36 100644 --- a/Makefile +++ b/Makefile @@ -239,7 +239,9 @@ fly-deploy-development-fresh: # test fly.io build locally before deploying (helps catch issues early) fly-build-test: @echo "๐Ÿงช Testing Fly.io build locally..." - docker build --no-cache -f docker/Dockerfile.fly -t anomstack-fly-test . + @GIT_COMMIT_HASH=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") && \ + echo "๐Ÿ“ Git commit hash: $$GIT_COMMIT_HASH" && \ + docker build --no-cache -f docker/Dockerfile.fly --build-arg ANOMSTACK_BUILD_HASH="$$GIT_COMMIT_HASH" -t anomstack-fly-test . @echo "โœ… Build successful! Testing container startup..." @echo "๐Ÿš€ Starting container on port 3001 (http://localhost:3001)..." @echo "Press Ctrl+C to stop the test container" diff --git a/dashboard/routes/index.py b/dashboard/routes/index.py index 29e6ef8..2c7c44b 100644 --- a/dashboard/routes/index.py +++ b/dashboard/routes/index.py @@ -19,11 +19,6 @@ from dashboard.constants import DEFAULT_LAST_N from dashboard.data import get_data -try: - from anomstack.version import get_version_string -except ImportError: - def get_version_string(): - return "version unknown" log = logging.getLogger("anomstack_dashboard") @@ -95,13 +90,7 @@ def create_main_content(batch_stats: dict, sorted_batch_names: list) -> Div: Card( DivLAligned( Div( - Div( - H2("Anomstack", cls="text-2xl font-bold pl-2"), - P( - get_version_string(), - cls="text-xs text-muted-foreground pl-2", - ), - ), + H2("Anomstack", cls="text-2xl font-bold pl-2"), P( "Painless open source anomaly detection for your metrics ๐Ÿ“ˆ๐Ÿ“‰๐Ÿš€", cls="text-muted-foreground pl-2", diff --git a/docker/Dockerfile.fly b/docker/Dockerfile.fly index df4431f..42f80a5 100644 --- a/docker/Dockerfile.fly +++ b/docker/Dockerfile.fly @@ -30,6 +30,10 @@ COPY anomstack ./anomstack COPY dashboard ./dashboard COPY metrics ./metrics +# Capture git commit hash for version info +ARG ANOMSTACK_BUILD_HASH +ENV ANOMSTACK_BUILD_HASH=${ANOMSTACK_BUILD_HASH} + # Copy configuration files COPY dagster_fly.yaml ./dagster_home/dagster.yaml COPY workspace.yaml ./dagster_home/workspace.yaml diff --git a/scripts/deployment/deploy_fly.sh b/scripts/deployment/deploy_fly.sh index 0d32ecc..1604447 100755 --- a/scripts/deployment/deploy_fly.sh +++ b/scripts/deployment/deploy_fly.sh @@ -234,6 +234,15 @@ rm fly.toml.bak # Deploy the application (force rebuild to ensure latest files are included) echo "๐Ÿš€ Deploying application..." +# Capture git commit hash for version tracking +GIT_COMMIT_HASH="" +if git rev-parse --short HEAD >/dev/null 2>&1; then + GIT_COMMIT_HASH=$(git rev-parse --short HEAD) + echo "๐Ÿ“ Git commit hash: $GIT_COMMIT_HASH" +else + echo "โš ๏ธ Could not determine git commit hash (not in a git repository or git not available)" +fi + if [[ "$FORCE_REBUILD" == "true" ]]; then # Generate unique cache busting value with timestamp + random CACHEBUST_VALUE="$(date +%s)-$(openssl rand -hex 4 2>/dev/null || echo $RANDOM)" @@ -243,15 +252,20 @@ if [[ "$FORCE_REBUILD" == "true" ]]; then # Use multiple cache busting strategies: # 1. --no-cache: Skip Docker layer cache # 2. CACHEBUST build arg: Force rebuild of layers that use it - # 3. --dockerfile: Explicit dockerfile path to avoid confusion + # 3. ANOMSTACK_BUILD_HASH build arg: Include git commit hash in container + # 4. --dockerfile: Explicit dockerfile path to avoid confusion fly deploy \ --no-cache \ --build-arg CACHEBUST="$CACHEBUST_VALUE" \ + --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ --dockerfile docker/Dockerfile.fly \ -a "$APP_NAME" else echo "โšก Standard deployment (with caching)..." - fly deploy --dockerfile docker/Dockerfile.fly -a "$APP_NAME" + fly deploy \ + --build-arg ANOMSTACK_BUILD_HASH="$GIT_COMMIT_HASH" \ + --dockerfile docker/Dockerfile.fly \ + -a "$APP_NAME" fi # Show the status From 443c051c1d972fe654c9a263bed3b79ea8b9b1b2 Mon Sep 17 00:00:00 2001 From: andrewm4894 Date: Sat, 23 Aug 2025 22:54:15 +0100 Subject: [PATCH 2/2] Remove obsolete gRPC test as gRPC is no longer used by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove test_architecture_grpc_section_exists since gRPC code server is no longer the default architecture - This aligns with recent changes to use gRPC-free architecture by default ๐Ÿค– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tests/test_docs_links.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/tests/test_docs_links.py b/tests/test_docs_links.py index 8050e66..e826514 100644 --- a/tests/test_docs_links.py +++ b/tests/test_docs_links.py @@ -42,24 +42,6 @@ def test_docusaurus_build_succeeds(): pytest.skip("yarn not available. Install Node.js and yarn to run this test.") -def test_architecture_grpc_section_exists(): - """Test that the gRPC opt-in section exists in ARCHITECTURE.md.""" - repo_root = Path(__file__).parent.parent - architecture_file = repo_root / "ARCHITECTURE.md" - - if not architecture_file.exists(): - pytest.skip("ARCHITECTURE.md not found") - - with open(architecture_file, 'r', encoding='utf-8') as f: - content = f.read() - - # Check that the gRPC section exists - assert "### Advanced: gRPC Code Server (Optional)" in content, \ - "ARCHITECTURE.md should contain the gRPC opt-in section" - - # Check that it mentions the anchor that docs link to - assert "advanced-grpc-code-server-optional" in content.lower().replace(' ', '-').replace(':', ''), \ - "gRPC section should be linkable with the expected anchor" if __name__ == "__main__": @@ -68,12 +50,6 @@ def test_architecture_grpc_section_exists(): print("๐Ÿ” Testing Docusaurus documentation...") - try: - test_architecture_grpc_section_exists() - print("โœ… gRPC section test passed") - except Exception as e: - print(f"โŒ gRPC section test failed: {e}") - sys.exit(1) try: test_docusaurus_build_succeeds()