본문으로 건너뛰기
cccskills
무료GitHub에 공개

mirrord-ci

Build CI workflows that use mirrord to test applications against services in a real Kubernetes cluster. Configure runner access, start and stop application sessions, validate configuration files, and troubleshoot connection, permission, and logging problems.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Help users set up mirrord in CI pipelines for testing against real Kubernetes environments. Use when users want to run end-to-end tests, integration tests, or automated tests in CI using mirrord to connect to staging/shared clusters.

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Run integration and end-to-end tests against staging
  • Create mirrord workflows for GitHub Actions or GitLab CI
  • Configure Kubernetes access from a CI runner
  • Stop sessions reliably after tests finish
  • Investigate CI connection failures and missing logs

포함된 파일(3)

  • SKILL.md13.1 KB
  • README.md1.7 KB
  • references/troubleshooting.md9.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Mirrord CI Skill

Purpose

Help users integrate mirrord into CI pipelines for testing against real Kubernetes environments:

  • Configure CI runners to connect to Kubernetes clusters
  • Set up mirrord ci start/stop commands in CI workflows
  • Generate CI workflow files for GitHub Actions, GitLab CI, etc.
  • Troubleshoot CI-specific mirrord issues

When to Use This Skill

Trigger on questions like:

  • "How do I use mirrord in CI?"
  • "Set up mirrord for GitHub Actions"
  • "Run tests against staging in CI"
  • "mirrord ci start not working"
  • "Configure mirrord for GitLab CI"

Security note for CI examples

  • Do not use remote pipe-to-shell installs or other unverified script execution in CI to install mirrord.
  • Pre-install mirrord in a trusted CI image, use your org’s approved package manager with pinned versions, or follow official install docs. The YAML below assumes mirrord is already available on the runner unless you add an approved install step.

Critical First Steps

Step 1: Load references Read the reference file from this skill's references/ directory:

  • references/troubleshooting.md - Common issues and solutions

The troubleshooting guide helps diagnose and fix common mirrord issues. To look up a config option, call explain_config_option if the mirrord MCP server is connected; otherwise use references/configuration.md in the mirrord-config skill.

If using absolute paths, search for them using patterns like **/mirrord-ci/references/*.

Step 2: Validate configs before presenting When generating mirrord configuration files for CI, ALWAYS validate them. If the mirrord MCP server is connected, call validate_config on the config; otherwise, if the mirrord CLI is installed, save it to a file and run:

mirrord verify-config /path/to/config.json

If neither is available, validate against references/schema.json in the mirrord-config skill, after parsing the config as strict JSON: read only the schema's top level (root properties, required, additionalProperties) and the definitions for the options the config uses (search the file for each key), not the whole file.

Key Benefits of mirrord for CI

  • Speed: ~50% faster CI pipelines by eliminating test environment setup
  • Cost: No need to spin up ephemeral clusters for each CI run
  • Accuracy: Test against real services, dependencies, and configurations
  • Isolation: Safe, isolated test execution that doesn't interfere with other workloads

Prerequisites

Required

  1. mirrord CLI version 3.181.0 or later
  2. Kubernetes cluster access from the CI runner
  3. kubeconfig configured in CI environment
  4. mirrord Operator installed with a Teams/Enterprise license. No license yet? An AI agent can offer the user a seven-day Enterprise trial and start it once they agree: see the mirrord-operator skill, "Agent-started trial".

Verification commands

# Check mirrord version
mirrord --version

# Verify cluster access
kubectl cluster-info
kubectl get pods -n <target-namespace>

Core Commands

Starting a CI session

mirrord ci start --target <target> -- <your-command>

This starts your application with mirrord in the background, allowing tests to run against it.

Examples:

# Node.js application
mirrord ci start --target deployment/api-server -- npm run start

# Python application
mirrord ci start --target pod/backend-abc123 -- python main.py

# With config file
mirrord ci start --config-file mirrord.json -- ./my-app

# Run in foreground (blocks until stopped)
mirrord ci start --foreground --target deployment/api -- npm start

Stopping CI sessions

mirrord ci stop

This stops all running mirrord CI sessions. Always run this after tests complete.

Multiple sessions

You can start multiple mirrord sessions in a single CI job:

mirrord ci start --target deployment/service-a -- ./service-a &
mirrord ci start --target deployment/service-b -- ./service-b &
# Run tests
npm test
# Stop all sessions
mirrord ci stop

CI API Key (for mirrord Enterprise)

This only applies to the Enterprise plan; if you're on the open-source version of mirrord, skip this section. When the mirrord Operator is installed in the cluster, mirrord ci commands require a CI API key, and generating one requires an Enterprise plan. Without it, every CI runner registers as a new user and consumes a seat:

# Generate the key (run locally, not in CI)
mirrord ci api-key

Store this as a secret environment variable named MIRRORD_CI_API_KEY in your CI platform.

Configuration

CI-specific config options

{
  "target": "deployment/my-app",
  "ci": {
    "output_dir": "/var/log/mirrord"
  }
}
OptionDescriptionDefault
ci.output_dirDirectory for stdout/stderr logsOS temp dir (e.g., /tmp/mirrord)

Application logs

By default, application stdout/stderr are saved to:

/tmp/mirrord/<binary-name>-<unique-id>/

CI Platform Examples

GitHub Actions

name: Integration Tests

on: [push, pull_request]

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

      - name: Set up kubeconfig
        run: |
          mkdir -p ~/.kube
          echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config

      - name: Ensure mirrord is installed
        run: |
          # Use a pre-built runner image that includes mirrord, or install via your org's approved method.
          # See https://mirrord.dev/docs/overview/quick-start/ — do not pipe remote install scripts.
          mirrord --version

      - name: Start app with mirrord
        run: |
          mirrord ci start --target deployment/api-server -- npm run start
        env:
          MIRRORD_CI_API_KEY: ${{ secrets.MIRRORD_CI_API_KEY }}

      - name: Run tests
        run: npm test

      - name: Stop mirrord
        if: always()
        run: mirrord ci stop

GitLab CI

integration-tests:
  stage: test
  image: node:20
  before_script:
    - |
      # Install mirrord - use your organization's approved installation method
      # See https://mirrord.dev/docs/overview/quick-start/ for options
      # Option A: Pre-install mirrord in your CI Docker image
      # Option B: Use a pinned version from GitHub Releases with checksum verification
      mirrord --version  # Verify mirrord is available
    - mkdir -p ~/.kube
    - echo "$KUBECONFIG_CONTENT" | base64 -d > ~/.kube/config
  script:
    - mirrord ci start --target deployment/api-server -- npm run start
    - npm test
  after_script:
    - mirrord ci stop
  variables:
    MIRRORD_CI_API_KEY: $MIRRORD_CI_API_KEY

CircleCI

version: 2.1

jobs:
  integration-test:
    docker:
      - image: cimg/node:20.0
    steps:
      - checkout
      - run:
          name: Setup kubeconfig
          command: |
            mkdir -p ~/.kube
            echo "$KUBECONFIG_B64" | base64 -d > ~/.kube/config
      - run:
          name: Ensure mirrord is installed
          command: |
            # Pre-install mirrord in the image or use an org-approved install path (see mirrord docs).
            mirrord --version
      - run:
          name: Start mirrord CI session
          command: mirrord ci start --target deployment/api -- npm start
          environment:
            MIRRORD_CI_API_KEY: ${MIRRORD_CI_API_KEY}
      - run:
          name: Run tests
          command: npm test
      - run:
          name: Stop mirrord
          command: mirrord ci stop
          when: always

Jenkins Pipeline

pipeline {
    agent any

    environment {
        KUBECONFIG = credentials('kubeconfig-staging')
        MIRRORD_CI_API_KEY = credentials('mirrord-ci-api-key')
    }

    stages {
        stage('Setup') {
            steps {
                sh '''
                    # Ensure mirrord exists on the agent (pre-installed image or org-approved install)
                    mirrord --version
                '''
            }
        }

        stage('Test') {
            steps {
                sh 'mirrord ci start --target deployment/api -- npm start'
                sh 'npm test'
            }
            post {
                always {
                    sh 'mirrord ci stop'
                }
            }
        }
    }
}

Kubernetes Access Setup

The CI runner must have access to your Kubernetes cluster. Common approaches:

1. Service Account (Recommended)

Create a dedicated service account for CI:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: ci-runner
  namespace: staging
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: mirrord-ci-role
  namespace: staging
rules:
- apiGroups: [""]
  resources: ["pods", "pods/log"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources: ["deployments"]
  verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: mirrord-ci-binding
  namespace: staging
subjects:
- kind: ServiceAccount
  name: ci-runner
  namespace: staging
roleRef:
  kind: Role
  name: mirrord-ci-role
  apiGroup: rbac.authorization.k8s.io

2. Cloud Provider Authentication

  • GKE: Use Workload Identity or service account key
  • EKS: Use IAM roles for service accounts (IRSA)
  • AKS: Use Azure AD pod identity or managed identity

Common Issues

For detailed troubleshooting, refer to references/troubleshooting.md.

CI-Specific Issues

IssueSolution
"kubectl not found"Install kubectl in CI runner
"Cannot connect to cluster"Check kubeconfig is properly configured
"mirrord ci start hangs"Ensure target pod exists and is running
"Permission denied"Check RBAC permissions for CI service account
"Session not stopping"Use mirrord ci stop in after_script or post block
"Logs not found"Check ci.output_dir config or default /tmp/mirrord
"Seats being consumed"Set MIRRORD_CI_API_KEY environment variable

General mirrord Issues

IssueSolution
mirrord seems to have no effectBinary may be statically linked. For Go: use go build -ldflags='-linkmode external'
Go DNS/outgoing filters not workingBuild with GODEBUG=netdns=cgo
Traffic doesn't reach local processCheck port mapping - local may listen on different port than remote
Traffic stops reaching remote targetWith service mesh, try {"agent": {"flush_connections": false}}
DNS resolution fails for K8s servicesChange feature.fs.mode from local to localwithoverrides
Permission (EACCES) errorsEnable privileged mode: {"agent": {"privileged": true}}
Agent pods not cleaned upRun: kubectl delete jobs --selector=app=mirrord --field-selector=status.successful=1
Certificate validation errors (macOS)Use {"experimental": {"trust_any_certificate": true}}
Service mesh drops agent connectionSet static agent.port and add port exclusion in mesh config

Framework-Specific Issues

Turbo (monorepo):

// turbo.json
{
  "globalPassThroughEnv": ["MIRRORD_*", "LD_PRELOAD", "DYLD_INSERT_LIBRARIES"]
}

Remix/Vite/Next.js - Override NODE_ENV to avoid production config:

{
  "feature": {
    "env": {
      "override": {
        "NODE_ENV": "development"
      }
    }
  }
}

Next.js with Nx - Exclude conflicting variables:

{
  "feature": {
    "env": {
      "exclude": ["NODE_ENV", "NX_NEXT_DIR"]
    }
  }
}

Multi-Container Pods

If your pod has multiple containers, specify the target container explicitly:

{
  "target": {
    "path": "pod/my-pod/container/my-app-container"
  }
}

Response Guidelines

  1. Ask about their CI platform - GitHub Actions, GitLab, CircleCI, Jenkins, etc.
  2. Verify prerequisites - kubectl access, mirrord version
  3. Provide platform-specific examples - Use the appropriate YAML/Groovy syntax
  4. Include cleanup steps - Always show mirrord ci stop in appropriate hooks
  5. Mention API key - Remind about MIRRORD_CI_API_KEY for Enterprise users

Example Interaction

User: "How do I run my tests against staging in GitHub Actions?"

Response:

  1. Ask: What's your target (deployment/pod name)?
  2. Check: Do you have kubeconfig set up as a secret?
  3. Provide: GitHub Actions workflow with:
    • kubeconfig setup
    • mirrord installation
    • mirrord ci start with their target
    • Test execution
    • mirrord ci stop in if: always() block
  4. Mention: MIRRORD_CI_API_KEY if using the Enterprise plan

Learn More

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Test how an app handles slow or failing dependencies by adding delays and connection errors to outgoing TCP connections in a mirrord session. Create reusable rules, manage them during development, and include them in CI tests.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Simulate slow database connections
  • Test retry behavior during connection timeouts
  • Run integration tests with failures in CI
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

Create, edit, and check mirrord.json files that connect a local application to Kubernetes. The skill produces minimal configurations, validates their structure and allowed settings, and explains problems with environment variables, files, and network behavior.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Create a configuration for connecting a local app to Kubernetes
  • Find and fix errors in an existing mirrord.json
  • Adjust environment variables and network behavior
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

Create and validate mirrord.json settings for isolated database copies used in development and testing. Configure connection sources, copying scope, migrations, and authentication so experiments can run without affecting shared databases.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Preparing isolated databases for development and testing
  • Choosing which schemas and data to copy
  • Configuring connection sources and IAM authentication
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

Update application code so a developer’s mirrord session identifier travels across service calls, queues, and storage events. Reuse existing tracing tools where possible, then report which request flows carry the identifier and where it still disappears.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Route downstream requests to the same developer session
  • Preserve session identifiers across queue consumers
  • Carry session context through upload events
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

Configure mirrord to route selected Kafka messages to a local application. Generate Kubernetes resource files and matching message filters, check their consistency, and troubleshoot connection or splitting issues, including Kafka Streams and AWS MSK IAM setups.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Set up Kafka message splitting for local debugging
  • Filter messages by headers or payload fields
  • Configure Kafka Streams or AWS MSK IAM connections
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

Install and configure mirrord Operator for team use on Kubernetes. The skill covers licensing, access permissions, feature settings, internal registries, and offline deployments, with guidance for upgrades and troubleshooting across supported cluster platforms.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Install mirrord Operator for a development team
  • Configure cloud authentication or offline licensing
  • Enable preview environments and database branches
metalbear-co/mirrord5.4천2026년 10월 24일 업데이트

metalbear-co의 스킬 모두 보기

이 스킬의 문제 신고