BETA

CI/CD: test a lab from GitHub Actions or GitLab CI

How-to4 min readUpdated July 2026

Every lab has a built-in test runner - three checks (node-health, connectivity, link-activity) exposed as three plain REST endpoints, so any CI runner can validate a topology with nothing but curl: zero client software required. This guide wires it into a pipeline.

The JSON below is a real captured test run, not a hand-written example - a two-node lab, tested live, all three checks passing.

Start a test run:

curl -sX POST "$NETPLEX_URL/api/v1/labs/$LAB_ID/test" \
  -H "Authorization: Bearer $NETPLEX_TOKEN" -H "Content-Type: application/json" \
  -d '{"timeout": 60}'
# → {"test_run_id":"4c9c8e70-c450-4e3a-a9b7-8fec66f295be","status":"running","lab_id":"..."}

Poll for completion, then read the results (real capture):

curl -s "$NETPLEX_URL/api/v1/labs/$LAB_ID/test/results" -H "Authorization: Bearer $NETPLEX_TOKEN"
{
  "status": "passed",
  "results": [
    { "step": "node-health",    "status": "pass", "detail": "all 2 node(s) running" },
    { "step": "connectivity",   "status": "pass", "detail": "no auto-assigned IPs - connectivity is user-configured; skipping auto-ping" },
    { "step": "link-activity",  "status": "pass", "detail": "fabric selftest..." }
  ]
}

Reusable script - the repo ships tools/netplex-ci.sh, which wraps exactly this start/poll/report loop and exits non-zero on failure (drop it straight into any CI runner):

NETPLEX_URL=https://your-netplex.example \
NETPLEX_TOKEN=npx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
LAB_ID=<lab-uuid> \
./tools/netplex-ci.sh
# prints ✓/✗ per check, exits 0 on pass / 1 on fail

GitHub Actions - a minimal job:

jobs:
  netplex-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./tools/netplex-ci.sh
        env:
          NETPLEX_URL: ${{ secrets.NETPLEX_URL }}
          NETPLEX_TOKEN: ${{ secrets.NETPLEX_TOKEN }}
          LAB_ID: ${{ vars.NETPLEX_LAB_ID }}

GitLab CI - the same script, same environment variables, as a plain job:

netplex-test:
  stage: test
  script:
    - ./tools/netplex-ci.sh
  variables:
    NETPLEX_URL: $NETPLEX_URL
    NETPLEX_TOKEN: $NETPLEX_TOKEN
    LAB_ID: $NETPLEX_LAB_ID

Use a scoped API token (not a username/password) for NETPLEX_TOKEN in CI - see "REST API quickstart" for creating one, and "Create an API token" for the UI. Store it as a CI secret, never in the pipeline file.