mcp-server-kubernetes
by Flux159
- mcp-server-kubernetes
- .github
- workflows
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Set up Minikube
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker
minikube status
- name: Start kubectl proxy
run: |
# Start the proxy in background and save the PID
# This gets around having to set the ca cert stuff in bun/node at ~/.minikube/ca.crt which didnt work because no SAN name in cert.
kubectl proxy --port=8080 &
echo "KUBECTL_PROXY_PID=$!" >> $GITHUB_ENV
# Give the proxy a moment to start
sleep 3
# Update the kubeconfig file to use the proxy URL
sed -i 's|https://192.168.49.2:8443|http://localhost:8080|g' ~/.kube/config
# Verify the change took effect
grep "server:" ~/.kube/config
- name: Run tests and generate JUnit report
run: |
# Run tests with both default and JUnit reporters
bun run test --reporter default --reporter junit --outputFile junit-results.xml
- name: Test Report
uses: dorny/test-reporter@v2
if: always()
with:
name: Bun Tests # Name of the check run which will be created
path: junit-results.xml # Path to test results
reporter: jest-junit # Format of test results (jest-junit is compatible with Bun's JUnit output)
fail-on-error: true # Fail the workflow if there are test failures
- name: Verify build works
run: bun run build
- name: Clean up kubectl proxy
if: always()
run: |
# Always attempt to kill the proxy process even if previous steps fail
if [ -n "$KUBECTL_PROXY_PID" ]; then
echo "Stopping kubectl proxy (PID: $KUBECTL_PROXY_PID)"
kill $KUBECTL_PROXY_PID || true
fi
# Restore the original kubeconfig (optional)
sed -i 's|http://localhost:8080|https://192.168.49.2:8443|g' ~/.kube/config