Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/actions/docker-push-quilt-ecr/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: 'Docker Push to Quilt ECR'
description: 'Build and push multi-platform Docker image to Quilt ECR repository'
inputs:
version:
description: 'Version tag for the Docker image'
required: true
ecr-registry:
description: 'ECR registry URL (e.g., 712023778557.dkr.ecr.us-east-1.amazonaws.com)'
required: true
ecr-repository:
description: 'ECR repository name (defaults to quilt-mcp-server)'
required: false
default: 'quilt-mcp-server'
aws-region:
description: 'AWS region for ECR'
required: false
default: 'us-east-1'
platforms:
description: 'Platforms to build for (defaults to linux/amd64)'
required: false
default: 'linux/amd64'
include-latest:
description: 'Also tag as latest (true/false)'
required: false
default: 'true'
dry-run:
description: 'Dry run mode - show what would be done without executing'
required: false
default: 'false'

outputs:
image-uri:
description: 'Full URI of the pushed Docker image'
value: ${{ steps.push.outputs.image-uri }}
tags:
description: 'All tags that were pushed'
value: ${{ steps.push.outputs.tags }}

runs:
using: 'composite'
steps:
- name: Validate inputs
shell: bash
run: |
if [[ -z "${{ inputs.version }}" ]]; then
echo "ERROR: Version is required"
exit 1
fi

if [[ -z "${{ inputs.ecr-registry }}" ]]; then
echo "ERROR: ECR registry is required"
exit 1
fi

echo "✅ Inputs validated"
echo "Version: ${{ inputs.version }}"
echo "Registry: ${{ inputs.ecr-registry }}"
echo "Repository: ${{ inputs.ecr-repository }}"
echo "Platforms: ${{ inputs.platforms }}"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ inputs.platforms }}

- name: Build and push Docker image
id: push
shell: bash
env:
VERSION: ${{ inputs.version }}
ECR_REGISTRY: ${{ inputs.ecr-registry }}
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
DOCKER_IMAGE_NAME: ${{ inputs.ecr-repository }}
run: |
echo "🐳 Building and pushing Docker image to Quilt ECR"
echo "Registry: ${ECR_REGISTRY}"
echo "Repository: ${DOCKER_IMAGE_NAME}"
echo "Version: ${VERSION}"
echo "Platforms: ${{ inputs.platforms }}"

# Determine if we should include latest tag
LATEST_FLAG=""
if [[ "${{ inputs.include-latest }}" != "true" ]]; then
LATEST_FLAG="--no-latest"
fi

# Add dry-run flag if requested
DRY_RUN_FLAG=""
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
DRY_RUN_FLAG="--dry-run"
echo "⚠️ DRY RUN MODE - No actual push will occur"
fi

# Use the docker.py script with platform specification
if uv run python scripts/docker.py push \
--version "${VERSION}" \
--registry "${ECR_REGISTRY}" \
--image "${DOCKER_IMAGE_NAME}" \
--platform "${{ inputs.platforms }}" \
${LATEST_FLAG} \
${DRY_RUN_FLAG}; then

echo "✅ Docker image successfully pushed"

# Set outputs
IMAGE_URI="${ECR_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}"
echo "image-uri=${IMAGE_URI}" >> $GITHUB_OUTPUT

if [[ "${{ inputs.include-latest }}" == "true" ]]; then
echo "tags=${VERSION},latest" >> $GITHUB_OUTPUT
else
echo "tags=${VERSION}" >> $GITHUB_OUTPUT
fi

echo "Docker image URI: ${IMAGE_URI}"
else
echo "❌ Failed to push Docker image"
exit 1
fi

- name: Verify image architecture
if: ${{ inputs.dry-run != 'true' }}
shell: bash
run: |
echo "🔍 Verifying pushed image architecture"

IMAGE_URI="${{ inputs.ecr-registry }}/${{ inputs.ecr-repository }}:${{ inputs.version }}"

# Pull and inspect the image manifest
aws ecr batch-get-image \
--repository-name "${{ inputs.ecr-repository }}" \
--image-ids imageTag="${{ inputs.version }}" \
--region "${{ inputs.aws-region }}" \
--output json \
--query 'images[0].imageManifest' | \
jq -r '.' | \
jq '.manifests[] | {platform: .platform, digest: .digest}'

echo "✅ Image architecture verification complete"
168 changes: 168 additions & 0 deletions .github/workflows/deploy-quilt-ecr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Deploy to Quilt ECR

on:
workflow_dispatch:
inputs:
version:
description: 'Version tag for the Docker image'
required: true
type: string
deploy-environment:
description: 'Deployment environment'
required: true
type: choice
options:
- development
- staging
- production
default: development
platforms:
description: 'Platforms to build for'
required: false
type: choice
options:
- linux/amd64
- linux/amd64,linux/arm64
default: linux/amd64
dry-run:
description: 'Dry run mode (no actual push)'
required: false
type: boolean
default: false

# Also trigger on releases for automated deployment
release:
types: [published]

jobs:
determine-config:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.config.outputs.version }}
environment: ${{ steps.config.outputs.environment }}
ecr-registry: ${{ steps.config.outputs.ecr-registry }}
ecr-repository: ${{ steps.config.outputs.ecr-repository }}
platforms: ${{ steps.config.outputs.platforms }}
dry-run: ${{ steps.config.outputs.dry-run }}
steps:
- name: Determine deployment configuration
id: config
run: |
# For manual workflow dispatch
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
ENVIRONMENT="${{ github.event.inputs.deploy-environment }}"
PLATFORMS="${{ github.event.inputs.platforms }}"
DRY_RUN="${{ github.event.inputs.dry-run }}"
# For release events
elif [[ "${{ github.event_name }}" == "release" ]]; then
# Extract version from release tag (remove 'v' prefix)
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"

# Determine environment based on release type
if [[ "${{ github.event.release.prerelease }}" == "true" ]] || [[ "$VERSION" == *"-dev"* ]]; then
ENVIRONMENT="development"
else
ENVIRONMENT="production"
fi

# Default platforms for automated releases
PLATFORMS="linux/amd64"
DRY_RUN="false"
fi

# Set ECR configuration based on environment
case "$ENVIRONMENT" in
production)
# Production Quilt ECR (us-east-1)
ECR_REGISTRY="712023778557.dkr.ecr.us-east-1.amazonaws.com"
ECR_REPOSITORY="quilt-mcp-server"
;;
staging)
# Staging Quilt ECR (us-east-2)
ECR_REGISTRY="712023778557.dkr.ecr.us-east-2.amazonaws.com"
ECR_REPOSITORY="tf-dev-mcp-server"
;;
development|*)
# Development Quilt ECR (us-east-2)
ECR_REGISTRY="712023778557.dkr.ecr.us-east-2.amazonaws.com"
ECR_REPOSITORY="tf-dev-mcp-server"
;;
esac

# Output configuration
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
echo "ecr-registry=$ECR_REGISTRY" >> $GITHUB_OUTPUT
echo "ecr-repository=$ECR_REPOSITORY" >> $GITHUB_OUTPUT
echo "platforms=$PLATFORMS" >> $GITHUB_OUTPUT
echo "dry-run=$DRY_RUN" >> $GITHUB_OUTPUT

# Log configuration
echo "📋 Deployment Configuration:"
echo " Version: $VERSION"
echo " Environment: $ENVIRONMENT"
echo " ECR Registry: $ECR_REGISTRY"
echo " ECR Repository: $ECR_REPOSITORY"
echo " Platforms: $PLATFORMS"
echo " Dry Run: $DRY_RUN"

deploy:
runs-on: ubuntu-latest
needs: determine-config
environment: ${{ needs.determine-config.outputs.environment }}
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup build environment
uses: ./.github/actions/setup-build-env
with:
python-version: '3.11'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.QUILT_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.QUILT_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ contains(needs.determine-config.outputs.ecr-registry, 'us-east-2') && 'us-east-2' || 'us-east-1' }}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Push Docker image to Quilt ECR
uses: ./.github/actions/docker-push-quilt-ecr
with:
version: ${{ needs.determine-config.outputs.version }}
ecr-registry: ${{ needs.determine-config.outputs.ecr-registry }}
ecr-repository: ${{ needs.determine-config.outputs.ecr-repository }}
aws-region: ${{ contains(needs.determine-config.outputs.ecr-registry, 'us-east-2') && 'us-east-2' || 'us-east-1' }}
platforms: ${{ needs.determine-config.outputs.platforms }}
include-latest: ${{ needs.determine-config.outputs.environment == 'production' }}
dry-run: ${{ needs.determine-config.outputs.dry-run }}

- name: Post deployment status
if: success() && needs.determine-config.outputs.dry-run != 'true'
run: |
echo "✅ Successfully deployed Docker image to Quilt ECR"
echo "Environment: ${{ needs.determine-config.outputs.environment }}"
echo "Version: ${{ needs.determine-config.outputs.version }}"
echo "Registry: ${{ needs.determine-config.outputs.ecr-registry }}"
echo "Repository: ${{ needs.determine-config.outputs.ecr-repository }}"

# Create deployment record (if in production)
if [[ "${{ needs.determine-config.outputs.environment }}" == "production" ]]; then
echo "📝 Recording production deployment"
# This could trigger additional production workflows or notifications
fi

- name: Notify deployment failure
if: failure()
run: |
echo "❌ Failed to deploy Docker image to Quilt ECR"
echo "Environment: ${{ needs.determine-config.outputs.environment }}"
echo "Version: ${{ needs.determine-config.outputs.version }}"
# This could trigger alerts or rollback procedures
27 changes: 26 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,29 @@ jobs:
uses: ./.github/actions/create-release
with:
package-version: ${{ steps.version.outputs.tag_version }}
# pypi-repository-url defaults to '' for PyPI
# pypi-repository-url defaults to '' for PyPI
build-docker: 'false' # We'll build and push to Quilt ECR separately

# Deploy to Quilt ECR for production infrastructure
- name: Configure AWS credentials for Quilt ECR
if: ${{ secrets.QUILT_AWS_ACCESS_KEY_ID != '' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.QUILT_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.QUILT_AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'

- name: Login to Quilt Amazon ECR
if: ${{ secrets.QUILT_AWS_ACCESS_KEY_ID != '' }}
uses: aws-actions/amazon-ecr-login@v2

- name: Deploy to Quilt Production ECR
if: ${{ secrets.QUILT_AWS_ACCESS_KEY_ID != '' }}
uses: ./.github/actions/docker-push-quilt-ecr
with:
version: ${{ steps.version.outputs.tag_version }}
ecr-registry: '712023778557.dkr.ecr.us-east-1.amazonaws.com'
ecr-repository: 'quilt-mcp-server'
aws-region: 'us-east-1'
platforms: 'linux/amd64'
include-latest: 'true'
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.14] - 2025-09-24

### Added

- **Health Check Endpoint**: Basic health monitoring for container orchestration (#197)
- New `/health` endpoint returning server status, timestamp, and version info
- Transport-aware registration (only enabled for HTTP/SSE/streamable-http transports)
- Comprehensive test coverage for health check functionality
- Foundation for future enhancements (component health, readiness/liveness probes)

### Changed

- **Docker Integration Tests**: Enhanced to verify health check endpoint availability
- Tests now validate both `/mcp` and `/health` endpoints
- Ensures health check responses include proper server metadata

## [0.6.13] - 2025-09-22

### Added
Expand Down
Loading