Split deploying to prod and staging (#666)

<!-- Provide a brief summary of your changes -->

## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->
The following PR splits the workflows for deploying to prod and staging
easing the use of gitops flows for promotions.

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->

## Breaking Changes
<!-- Will users need to update their code or configurations? -->

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [ ] My code follows the repository's style guidelines
- [ ] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
This commit is contained in:
Radoslav Dimitrov 2025-10-14 18:41:28 +03:00 • committed by GitHub
commit f5ed8728d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 50 deletions

56
.github/workflows/deploy-production.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: Deploy to Production
on:
push:
branches:
- main
paths:
- 'deploy/Pulumi.gcpProd.yaml'
permissions:
contents: read
env:
PULUMI_VERSION: "3.188.0"
jobs:
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
environment: production
concurrency:
group: deploy-production
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: 'go.mod'
cache: true
- name: Setup Pulumi
uses: pulumi/actions@d7ceb0215da5a14ec84f50b703365ddf0194a9c8
with:
pulumi-version: ${{ env.PULUMI_VERSION }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
with:
credentials_json: ${{ secrets.GCP_PROD_SERVICE_ACCOUNT_KEY }}
- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
with:
project_id: mcp-registry-prod
install_components: gke-gcloud-auth-plugin
- name: Deploy to Production
working-directory: ./deploy
env:
PULUMI_PROD_PASSPHRASE: ${{ secrets.PULUMI_PROD_PASSPHRASE }}
run: |
echo "$PULUMI_PROD_PASSPHRASE" > passphrase.prod.txt
make prod-up

98
.github/workflows/deploy-staging.yml vendored Normal file
View file

@ -0,0 +1,98 @@
name: Deploy to Staging
on:
push:
branches:
- main
paths-ignore:
- 'deploy/Pulumi.gcpProd.yaml'
permissions:
contents: read
env:
PULUMI_VERSION: "3.188.0"
jobs:
docker-push:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
- name: Log in to Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=sha,prefix=main-{{date 'YYYYMMDD'}}-,enable={{is_default_branch}}
type=raw,value=main,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
environment: staging
needs: docker-push
concurrency:
group: deploy-staging
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: 'go.mod'
cache: true
- name: Setup Pulumi
uses: pulumi/actions@d7ceb0215da5a14ec84f50b703365ddf0194a9c8
with:
pulumi-version: ${{ env.PULUMI_VERSION }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
with:
credentials_json: ${{ secrets.GCP_STAGING_SERVICE_ACCOUNT_KEY }}
- name: Setup Google Cloud SDK
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
with:
project_id: mcp-registry-staging
install_components: gke-gcloud-auth-plugin
- name: Deploy to Staging
working-directory: ./deploy
env:
PULUMI_STAGING_PASSPHRASE: ${{ secrets.PULUMI_STAGING_PASSPHRASE }}
run: |
echo "$PULUMI_STAGING_PASSPHRASE" > passphrase.staging.txt
make staging-up

View file

@ -29,15 +29,34 @@ PULUMI_CONFIG_PASSPHRASE="" pulumi config set mcp-registry:githubClientSecret --
### Production Deployment (GCP) ### Production Deployment (GCP)
**Note:** The production deployment is automatically handled by GitHub Actions. All merges to the `main` branch trigger an automatic deployment the `staging` environment at GCP via [the configured GitHub Actions workflow](../.github/workflows/deploy.yml). **Note:** Deployments are automatically handled by GitHub Actions with separate workflows for staging and production:
**Important:** Deployment to `prod` require explicit configuration of the Docker image tag in `Pulumi.gcpProd.yaml`. This prevents automatic promotion of new releases and provides manual control over production versions. To deploy a specific version: - **Staging:** All merges to the `main` branch automatically build and deploy the latest code to the `staging` environment via [deploy-staging.yml](../.github/workflows/deploy-staging.yml). Staging always uses the `:main` Docker image tag.
1. Update `mcp-registry:imageTag` in `Pulumi.gcpProd.yaml` to the desired version (e.g., `v1.0.0`, `main-20250930-abc123d`) - **Production:** Deployment requires explicit configuration of the Docker image tag in `Pulumi.gcpProd.yaml` and is triggered automatically via [deploy-production.yml](../.github/workflows/deploy-production.yml) when this config file is pushed to `main`. This GitOps-style approach provides manual control and an audit trail for production versions.
2. Commit the changes and open a PR to `main`
3. Once merged, the GitHub Actions workflow will deploy the specified version
The steps below are preserved as a log of what we did, or if a manual override is needed. **To deploy a specific version to production:**
1. Cut a release (if deploying a new version):
```bash
# Via GitHub UI: https://github.com/modelcontextprotocol/registry/releases
# Or via gh CLI:
gh release create v1.2.3 --generate-notes
```
This builds Docker images tagged as `v1.2.3` and `latest`
2. Update the production image tag in `Pulumi.gcpProd.yaml`:
```bash
# Edit deploy/Pulumi.gcpProd.yaml
# Change line: mcp-registry:imageTag: v1.2.3
git add deploy/Pulumi.gcpProd.yaml
git commit -m "Deploy v1.2.3 to production"
git push
```
3. The production deployment workflow will automatically trigger and deploy the specified version
**Manual Override:** The steps below are preserved if a manual deployment override is needed.
Pre-requisites: Pre-requisites:
- [Pulumi CLI installed](https://www.pulumi.com/docs/iac/download-install/) - [Pulumi CLI installed](https://www.pulumi.com/docs/iac/download-install/)

View file

@ -21,7 +21,13 @@ The release workflow will automatically:
- `ghcr.io/modelcontextprotocol/registry:vX.Y.Z` - Specific release version - `ghcr.io/modelcontextprotocol/registry:vX.Y.Z` - Specific release version
- Binaries can be downloaded from the GitHub release page - Binaries can be downloaded from the GitHub release page
**Note:** Releases do not automatically deploy to production. See the [deployment documentation](../../deploy/README.md) for production deployment instructions. **Note:** Releases do not automatically deploy to production. To deploy a release to production:
1. Update `mcp-registry:imageTag` in `deploy/Pulumi.gcpProd.yaml` to the desired version (e.g., `v1.2.3`)
2. Commit and push the change to the `main` branch
3. The [deploy-production.yml](../../../.github/workflows/deploy-production.yml) workflow will automatically trigger and deploy the specified version
See the [deployment documentation](../../../deploy/README.md) for more details.
## Docker Image Tags ## Docker Image Tags