HyperRoute

CI/CD Integration

DevKit is designed to be CI/CD native with structured exit codes, JSON output, and concurrency-safe registry locking.


Exit Codes

CodeMeaningCI Action
0Success — deployed and activatedContinue pipeline
10Pending approval — proposal createdWait / notify
11Rejected — proposal was deniedFail pipeline
12Policy violation — blocked by policyFail pipeline
13Registry error — storage issueRetry
14Platform API errorRetry
15Router activation errorInvestigate

GitHub Actions

name: Deploy Schema
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install DevKit
        run: curl -fsSL https://releases.hyperroute.dev/devkit/install.sh | bash

      - name: Push Schema
        env:
          HYPERROUTE_API_KEY: ${{ secrets.HYPERROUTE_API_KEY }}
        run: |
          hyperroute push \
            --env production \
            --name ${{ github.event.repository.name }} \
            --schema dist/schema.graphql \
            --url ${{ vars.SERVICE_URL }} \
            --json

      - name: Handle approval
        if: ${{ failure() }}
        run: |
          EXIT_CODE=$?
          if [ "$EXIT_CODE" = "10" ]; then
            echo "::warning::Schema change requires approval"
          fi

GitLab CI

deploy-schema:
  stage: deploy
  script:
    - curl -fsSL https://releases.hyperroute.dev/devkit/install.sh | bash
    - hyperroute push
        --env production
        --name ${CI_PROJECT_NAME}
        --schema dist/schema.graphql
        --url ${SERVICE_URL}
        --json
  allow_failure:
    exit_codes:
      - 10  # Pending approval

Generic CI Script

#!/bin/bash
set -e

# Install DevKit
curl -fsSL https://releases.hyperroute.dev/devkit/install.sh | bash

# Push schema and capture exit code
set +e
hyperroute push --env production \
  --name products \
  --schema dist/schema.graphql \
  --url http://products:4001/graphql \
  --json
EXIT_CODE=$?
set -e

case $EXIT_CODE in
  0)  echo "✅ Deployed successfully" ;;
  10) echo "⏳ Awaiting approval — check Platform UI" ;;
  11) echo "❌ Rejected" && exit 1 ;;
  12) echo "❌ Policy violation" && exit 1 ;;
  *)  echo "❌ Error (code $EXIT_CODE)" && exit 1 ;;
esac

Tips

  • Use --json for machine-parseable output in CI
  • Use --wait to block the pipeline until approval resolves
  • Use --timeout to set a maximum wait time
  • Use --git-sha and --git-branch for traceability (auto-detected from git if not provided)
  • Set HYPERROUTE_API_KEY as a secret in your CI platform