Skip to content

Kubernetes nightly build (Monorepo) #41

Kubernetes nightly build (Monorepo)

Kubernetes nightly build (Monorepo) #41

name: Kubernetes nightly build (Monorepo)
permissions:
contents: read
on:
workflow_dispatch:
schedule:
- cron: "0 20 * * *"
pull_request:
branches: [ main ]
paths:
- '.github/workflows/kubernetes-nightly-build.yml'
- 'scripts/python-k8s-e2e.sh'
- 'scripts/python-k8s-e2e-ingress.sh'
- 'scripts/common/kubernetes-e2e.sh'
- 'kubernetes/charts/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
k8s-mini-e2e:
name: Kubernetes mini E2E (${{ matrix.variant }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- variant: direct
script: scripts/python-k8s-e2e.sh
e2e_gateway_route_mode: ""
- variant: ingress-header
script: scripts/python-k8s-e2e-ingress.sh
e2e_gateway_route_mode: ""
- variant: ingress-uri
script: scripts/python-k8s-e2e-ingress.sh
e2e_gateway_route_mode: uri
env:
KIND_CLUSTER: opensandbox-e2e
KIND_K8S_VERSION: v1.30.4
KUBECONFIG_PATH: /tmp/opensandbox-kind-kubeconfig
KUBECONFIG: /tmp/opensandbox-kind-kubeconfig
OPENSANDBOX_E2E_SANDBOX_CPU: 250m
OPENSANDBOX_E2E_SANDBOX_MEMORY: 512Mi
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.24.0"
- name: Add Go bin to PATH
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up kubectl
uses: azure/setup-kubectl@v4
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Run Kubernetes runtime E2E
env:
E2E_GATEWAY_ROUTE_MODE: ${{ matrix.e2e_gateway_route_mode }}
run: bash "./${{ matrix.script }}"
- name: Dump kind diagnostics
if: always()
run: |
kubectl get pods -A -o wide || true
kubectl get batchsandboxes -A || true
kubectl get pv,pvc -A || true
kubectl describe deployment -n opensandbox-system opensandbox-controller-manager || true
kubectl describe deployment -n opensandbox-system opensandbox-server || true
kubectl get svc -n opensandbox-system opensandbox-server || true
- name: Eval in-cluster server logs
if: always()
run: |
kubectl logs -n opensandbox-system deployment/opensandbox-server || true
cat /tmp/opensandbox-server-port-forward.log || true
- name: Upload Python test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: python-k8s-e2e-logs-${{ matrix.variant }}
path: |
/tmp/opensandbox-server-port-forward.log
/tmp/opensandbox-ingress-gateway-port-forward.log
if-no-files-found: ignore
retention-days: 5
- name: Clean up Kind cluster
if: always()
run: |
kind delete cluster --name "${KIND_CLUSTER}" || true
publish-nightly-latest:
name: Publish latest (${{ matrix.component }} nightly)
needs: k8s-mini-e2e
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- component: execd
workdir: components/execd
- component: ingress
workdir: components/ingress
- component: egress
workdir: components/egress
- component: controller
workdir: kubernetes
k8s_component: controller
- component: task-executor
workdir: kubernetes
k8s_component: task-executor
- component: server
workdir: server
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to ACR
uses: docker/login-action@v3
with:
registry: sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and push (TAG=latest)
working-directory: ${{ matrix.workdir }}
run: |
export TAG=latest
if [ -n "${{ matrix.k8s_component }}" ]; then
export COMPONENT="${{ matrix.k8s_component }}"
fi
chmod +x build.sh
./build.sh