|
6 | 6 |
|
7 | 7 | permissions: |
8 | 8 | contents: read |
9 | | - packages: write |
| 9 | + packages: read |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - build-gateway: |
| 12 | + e2e: |
13 | 13 | if: contains(github.event.pull_request.labels.*.name, 'test:e2e') |
14 | | - uses: ./.github/workflows/docker-build.yml |
15 | | - with: |
16 | | - component: gateway |
17 | | - platform: linux/arm64 |
18 | | - runner: build-arm64 |
| 14 | + name: E2E |
| 15 | + runs-on: build-arm64 |
| 16 | + timeout-minutes: 45 |
| 17 | + container: |
| 18 | + image: ghcr.io/nvidia/openshell/ci:latest |
| 19 | + credentials: |
| 20 | + username: ${{ github.actor }} |
| 21 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + options: --privileged |
| 23 | + volumes: |
| 24 | + - /var/run/docker.sock:/var/run/docker.sock |
| 25 | + env: |
| 26 | + MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + # Single platform so buildx uses --load (no registry push needed). |
| 28 | + DOCKER_PLATFORM: linux/arm64 |
| 29 | + EXTRA_CARGO_FEATURES: openshell-core/dev-settings |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
19 | 32 |
|
20 | | - build-cluster: |
21 | | - if: contains(github.event.pull_request.labels.*.name, 'test:e2e') |
22 | | - uses: ./.github/workflows/docker-build.yml |
23 | | - with: |
24 | | - component: cluster |
25 | | - platform: linux/arm64 |
26 | | - runner: build-arm64 |
| 33 | + - name: Install tools |
| 34 | + run: mise install |
27 | 35 |
|
28 | | - e2e: |
29 | | - needs: [build-gateway, build-cluster] |
30 | | - uses: ./.github/workflows/e2e-test.yml |
31 | | - with: |
32 | | - image-tag: ${{ github.sha }} |
33 | | - runner: build-arm64 |
| 36 | + - name: Install dependencies |
| 37 | + run: | |
| 38 | + uv sync --frozen |
| 39 | + apt-get update && apt-get install -y --no-install-recommends openssh-client && rm -rf /var/lib/apt/lists/* |
| 40 | +
|
| 41 | + - name: Resolve Docker host gateway |
| 42 | + id: hostgw |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + # Get the IP the CI container uses to reach the Docker host. |
| 46 | + # The local registry binds to port 5000 on the host, so sibling |
| 47 | + # containers (CI, k3s) reach it via the default gateway IP. |
| 48 | + DOCKER_HOST_IP="" |
| 49 | + if command -v ip >/dev/null 2>&1; then |
| 50 | + DOCKER_HOST_IP=$(ip route | awk '/default/ {print $3}') |
| 51 | + fi |
| 52 | + if [[ -z "$DOCKER_HOST_IP" ]] && [[ -r /proc/net/route ]]; then |
| 53 | + GW_HEX=$(awk '$2 == "00000000" {print $3; exit}' /proc/net/route) |
| 54 | + if [[ -n "$GW_HEX" ]]; then |
| 55 | + DOCKER_HOST_IP=$(printf "%d.%d.%d.%d" \ |
| 56 | + "0x${GW_HEX:6:2}" "0x${GW_HEX:4:2}" "0x${GW_HEX:2:2}" "0x${GW_HEX:0:2}") |
| 57 | + fi |
| 58 | + fi |
| 59 | + if [[ -z "$DOCKER_HOST_IP" ]]; then |
| 60 | + DOCKER_HOST_IP=$(docker network inspect bridge \ |
| 61 | + --format '{{range .IPAM.Config}}{{.Gateway}}{{end}}' 2>/dev/null || echo "172.17.0.1") |
| 62 | + fi |
| 63 | + echo "ip=${DOCKER_HOST_IP}" >> "$GITHUB_OUTPUT" |
| 64 | + echo "Docker host gateway: ${DOCKER_HOST_IP}" |
| 65 | +
|
| 66 | + - name: Start local registry |
| 67 | + run: | |
| 68 | + docker rm -f openshell-local-registry 2>/dev/null || true |
| 69 | + docker run -d --restart=always --name openshell-local-registry -p 5000:5000 registry:2 |
| 70 | + for i in $(seq 1 20); do |
| 71 | + if docker exec openshell-local-registry wget -qO- http://localhost:5000/v2/ >/dev/null 2>&1; then |
| 72 | + echo "Registry ready" |
| 73 | + break |
| 74 | + fi |
| 75 | + sleep 1 |
| 76 | + done |
| 77 | +
|
| 78 | + - name: Build images |
| 79 | + run: | |
| 80 | + mise run docker:build:gateway |
| 81 | + mise run docker:build:cluster |
| 82 | +
|
| 83 | + - name: Push gateway to local registry |
| 84 | + env: |
| 85 | + DOCKER_HOST_IP: ${{ steps.hostgw.outputs.ip }} |
| 86 | + run: | |
| 87 | + IMAGE_TAG=${IMAGE_TAG:-dev} |
| 88 | + docker tag openshell/gateway:${IMAGE_TAG} ${DOCKER_HOST_IP}:5000/openshell/gateway:${IMAGE_TAG} |
| 89 | + docker push ${DOCKER_HOST_IP}:5000/openshell/gateway:${IMAGE_TAG} |
| 90 | +
|
| 91 | + - name: Bootstrap cluster |
| 92 | + env: |
| 93 | + GATEWAY_HOST: host.docker.internal |
| 94 | + GATEWAY_PORT: "8080" |
| 95 | + SKIP_IMAGE_PUSH: "1" |
| 96 | + SKIP_CLUSTER_IMAGE_BUILD: "1" |
| 97 | + OPENSHELL_REGISTRY: ${{ steps.hostgw.outputs.ip }}:5000/openshell |
| 98 | + OPENSHELL_REGISTRY_HOST: ${{ steps.hostgw.outputs.ip }}:5000 |
| 99 | + OPENSHELL_REGISTRY_NAMESPACE: openshell |
| 100 | + OPENSHELL_REGISTRY_ENDPOINT: host.docker.internal:5000 |
| 101 | + OPENSHELL_REGISTRY_INSECURE: "true" |
| 102 | + run: mise run --no-prepare --skip-deps cluster |
| 103 | + |
| 104 | + - name: Run E2E tests |
| 105 | + run: | |
| 106 | + mise run --no-prepare --skip-deps e2e:python |
| 107 | + mise run --no-prepare --skip-deps e2e:rust |
0 commit comments