From 9cc04e61c98f2ea593a6f72b806790bb44471df0 Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Thu, 30 Oct 2025 23:47:19 -0700 Subject: [PATCH] Fix MCP server release workflow to build all Dockerfile variants (#1037) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * conductor-checkpoint-start * conductor-checkpoint-msg_0121yRVkMGS2UzMazKiZkgi4 * conductor-checkpoint-msg_01NvLs9EFt8qNiQqtYY8V9WV * conductor-checkpoint-msg_013iKczSUmjtzPEdcgciXJUd * conductor-checkpoint-msg_01BFgirbgmehsEGCMWjgSsnv * conductor-checkpoint-msg_01TA4DYecHTJ36ndBsU9ooyf * Fix critical issues in MCP release workflow Address all critical review comments: 1. Fix malformed Docker tags - Change tag suffixes from colons to hyphens - standalone: 1.0.0-standalone (not 1.0.0:standalone) - combined: 1.0.0 and latest (not :latest) 2. Add checkout ref for manual triggers - Use inputs.tag for workflow_dispatch events - Ensures manual builds use correct tag ref 3. Add tag input validation - Validate tag format (mcp-vX.Y.Z) before processing - Provide clear error messages for invalid input 4. Fix release summary overwriting - Both matrix jobs now append to summary correctly - Each variant creates distinct summary section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * conductor-checkpoint-msg_01H4GqBSkLiPgUfHGD57nq5V * conductor-checkpoint-msg_01T2zdZLAZpVSip6EaiYa66k * Address code review findings - fix critical checkout ref bug Fix all critical and high-priority issues from code review: 1. Fix checkout ref logic (CRITICAL) - Simplified to: ref: ${{ inputs.tag || github.ref }} - Works correctly for both workflow_dispatch and push events - Removes conditional logic that would fail for manual triggers 2. Consolidate tag validation - Remove duplicate validation logic - Single validation path for both trigger types - Clearer error messages with received value 3. Add PyPI error handling - Use curl -sf for proper error codes - Validate GRAPHITI_VERSION is not empty - Exit with clear error if PyPI fetch fails 4. Improve docker-compose comments - Add concrete version tag examples - Show users how to pin specific versions - Clarify when local build vs registry pull is used 5. Update workflow_dispatch description - Clarify tag must already exist in repo - Prevent user confusion about tag creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * conductor-checkpoint-msg_01KgG6FyiqNNdc51BCehNBjm * Fix error handling bug in PyPI version fetch The previous error handling was broken due to set -e causing immediate exit, making the $? check unreachable. Changes: - Use set -eo pipefail for proper pipeline error handling - Check command success with if ! command; then pattern - Separate check for empty version string - Both checks now properly reachable and functional 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --------- Co-authored-by: Claude --- .github/workflows/release-mcp-server.yml | 85 ++++++++++++++----- mcp_server/docker/docker-compose-falkordb.yml | 3 + mcp_server/docker/docker-compose-neo4j.yml | 3 + mcp_server/docker/docker-compose.yml | 4 +- 4 files changed, 74 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release-mcp-server.yml b/.github/workflows/release-mcp-server.yml index 8c436c82..62ff8609 100644 --- a/.github/workflows/release-mcp-server.yml +++ b/.github/workflows/release-mcp-server.yml @@ -3,6 +3,12 @@ name: Release MCP Server on: push: tags: ["mcp-v*.*.*"] + workflow_dispatch: + inputs: + tag: + description: 'Existing tag to release (e.g., mcp-v1.0.0) - tag must exist in repo' + required: true + type: string env: REGISTRY: docker.io @@ -16,9 +22,26 @@ jobs: id-token: write environment: name: release + strategy: + matrix: + variant: + - name: standalone + dockerfile: docker/Dockerfile.standalone + image_suffix: "-standalone" + tag_latest: "standalone" + title: "Graphiti MCP Server (Standalone)" + description: "Standalone Graphiti MCP server for external Neo4j or FalkorDB" + - name: combined + dockerfile: docker/Dockerfile + image_suffix: "" + tag_latest: "latest" + title: "FalkorDB + Graphiti MCP Server" + description: "Combined FalkorDB graph database with Graphiti MCP server" steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref }} - name: Set up Python 3.11 uses: actions/setup-python@v5 @@ -28,17 +51,26 @@ jobs: - name: Extract and validate version id: version run: | - TAG_VERSION=${GITHUB_REF#refs/tags/mcp-v} + # Extract tag from either push event or manual workflow_dispatch input + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + TAG_FULL="${{ inputs.tag }}" + TAG_VERSION=${TAG_FULL#mcp-v} + else + TAG_VERSION=${GITHUB_REF#refs/tags/mcp-v} + fi + # Validate semantic versioning format if ! [[ $TAG_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Tag must follow semantic versioning: mcp-vX.Y.Z" + echo "Error: Tag must follow semantic versioning: mcp-vX.Y.Z (e.g., mcp-v1.0.0)" + echo "Received: mcp-v$TAG_VERSION" exit 1 fi + # Validate against pyproject.toml version PROJECT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('mcp_server/pyproject.toml', 'rb'))['project']['version'])") if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then - echo "Tag version mcp-v$TAG_VERSION does not match mcp_server/pyproject.toml version $PROJECT_VERSION" + echo "Error: Tag version mcp-v$TAG_VERSION does not match mcp_server/pyproject.toml version $PROJECT_VERSION" exit 1 fi @@ -57,8 +89,19 @@ jobs: - name: Get latest graphiti-core version from PyPI id: graphiti run: | - # Query PyPI for the latest graphiti-core version - GRAPHITI_VERSION=$(curl -s https://pypi.org/pypi/graphiti-core/json | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") + # Query PyPI for the latest graphiti-core version with error handling + set -eo pipefail + + if ! GRAPHITI_VERSION=$(curl -sf https://pypi.org/pypi/graphiti-core/json | python -c "import sys, json; data=json.load(sys.stdin); print(data['info']['version'])"); then + echo "Error: Failed to fetch graphiti-core version from PyPI" + exit 1 + fi + + if [ -z "$GRAPHITI_VERSION" ]; then + echo "Error: Empty version returned from PyPI" + exit 1 + fi + echo "graphiti_version=${GRAPHITI_VERSION}" >> $GITHUB_OUTPUT echo "Latest Graphiti Core version from PyPI: ${GRAPHITI_VERSION}" @@ -74,21 +117,22 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=raw,value=${{ steps.version.outputs.version }} - type=raw,value=${{ steps.version.outputs.version }}-graphiti-${{ steps.graphiti.outputs.graphiti_version }} - type=raw,value=latest + type=raw,value=${{ steps.version.outputs.version }}${{ matrix.variant.image_suffix }} + type=raw,value=${{ steps.version.outputs.version }}-graphiti-${{ steps.graphiti.outputs.graphiti_version }}${{ matrix.variant.image_suffix }} + type=raw,value=${{ matrix.variant.tag_latest }} labels: | - org.opencontainers.image.title=Graphiti MCP Server - org.opencontainers.image.description=MCP server for Graphiti knowledge graph + org.opencontainers.image.title=${{ matrix.variant.title }} + org.opencontainers.image.description=${{ matrix.variant.description }} org.opencontainers.image.version=${{ steps.version.outputs.version }} org.opencontainers.image.vendor=Zep AI graphiti.core.version=${{ steps.graphiti.outputs.graphiti_version }} - - name: Build and push Docker image + - name: Build and push Docker image (${{ matrix.variant.name }}) uses: depot/build-push-action@v1 with: project: v9jv1mlpwc context: ./mcp_server + file: ./mcp_server/${{ matrix.variant.dockerfile }} platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.docker_meta.outputs.tags }} @@ -101,11 +145,14 @@ jobs: - name: Create release summary run: | - echo "## MCP Server Release Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**MCP Server Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY - echo "**Graphiti Core Version:** ${{ steps.graphiti.outputs.graphiti_version }}" >> $GITHUB_STEP_SUMMARY - echo "**Build Date:** ${{ steps.meta.outputs.build_date }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Docker Image Tags" >> $GITHUB_STEP_SUMMARY - echo "${{ steps.docker_meta.outputs.tags }}" | tr ',' '\n' | sed 's/^/- /' >> $GITHUB_STEP_SUMMARY + { + echo "## MCP Server Release Summary - ${{ matrix.variant.title }}" + echo "" + echo "**MCP Server Version:** ${{ steps.version.outputs.version }}" + echo "**Graphiti Core Version:** ${{ steps.graphiti.outputs.graphiti_version }}" + echo "**Build Date:** ${{ steps.meta.outputs.build_date }}" + echo "" + echo "### Docker Image Tags" + echo "${{ steps.docker_meta.outputs.tags }}" | tr ',' '\n' | sed 's/^/- /' + echo "" + } >> $GITHUB_STEP_SUMMARY diff --git a/mcp_server/docker/docker-compose-falkordb.yml b/mcp_server/docker/docker-compose-falkordb.yml index 3b6fe163..1f99cba2 100644 --- a/mcp_server/docker/docker-compose-falkordb.yml +++ b/mcp_server/docker/docker-compose-falkordb.yml @@ -17,6 +17,9 @@ services: graphiti-mcp: image: zepai/knowledge-graph-mcp:standalone + # For specific versions, replace 'standalone' with a version tag: + # image: zepai/knowledge-graph-mcp:1.0.0-standalone + # When building locally, the build section below will be used. build: context: .. dockerfile: docker/Dockerfile.standalone diff --git a/mcp_server/docker/docker-compose-neo4j.yml b/mcp_server/docker/docker-compose-neo4j.yml index 3b416822..ea911214 100644 --- a/mcp_server/docker/docker-compose-neo4j.yml +++ b/mcp_server/docker/docker-compose-neo4j.yml @@ -21,6 +21,9 @@ services: graphiti-mcp: image: zepai/knowledge-graph-mcp:standalone + # For specific versions, replace 'standalone' with a version tag: + # image: zepai/knowledge-graph-mcp:1.0.0-standalone + # When building locally, the build section below will be used. build: context: .. dockerfile: docker/Dockerfile.standalone diff --git a/mcp_server/docker/docker-compose.yml b/mcp_server/docker/docker-compose.yml index b6c50fef..1986110b 100644 --- a/mcp_server/docker/docker-compose.yml +++ b/mcp_server/docker/docker-compose.yml @@ -1,12 +1,12 @@ services: graphiti-falkordb: - image: zepai/graphiti-falkordb:latest + image: zepai/knowledge-graph-mcp:latest build: context: .. dockerfile: docker/Dockerfile args: GRAPHITI_CORE_VERSION: ${GRAPHITI_CORE_VERSION:-0.22.0} - MCP_SERVER_VERSION: ${MCP_SERVER_VERSION:-1.0.0rc0} + MCP_SERVER_VERSION: ${MCP_SERVER_VERSION:-1.0.0} BUILD_DATE: ${BUILD_DATE:-} VCS_REF: ${VCS_REF:-} env_file: