|
| 1 | +name: OpenShell gateway smoke |
| 2 | + |
| 3 | +# Opt-in live check of the OpenShell fleet integration against a REAL gateway. |
| 4 | +# The job runs only when a repository administrator configures gateway access; |
| 5 | +# otherwise every step skips and pull requests stay green. |
| 6 | +# |
| 7 | +# How to enable (repository secrets, set once by an administrator): |
| 8 | +# OPENSHELL_SMOKE_GATEWAY_URL the gateway control-plane base URL (https) |
| 9 | +# OPENSHELL_SMOKE_GATEWAY_CREDENTIAL the bearer credential the gateway's OIDC |
| 10 | +# token provider returns to the OpenShell SDK |
| 11 | +# OPENSHELL_SMOKE_NPM_TOKEN a token with read access to the @nvidia |
| 12 | +# scope on npm.pkg.github.com (the SDK ships |
| 13 | +# only via GitHub Packages). Never echoed, |
| 14 | +# never committed; the install is masked and |
| 15 | +# lives in a scratch directory outside the |
| 16 | +# repository, so it cannot enter |
| 17 | +# package.json or the pnpm lockfile. |
| 18 | +# Optional repository variable: |
| 19 | +# OPENSHELL_SMOKE_TEMPLATE sandbox template to spawn; unset falls |
| 20 | +# back to a worker-labeled template listed |
| 21 | +# by the gateway. |
| 22 | +# What the gateway must expose: health, sandbox template listing, sandbox |
| 23 | +# create/wait/get/delete, and label filtering on `t3-managed-by`. |
| 24 | +# Budget: the script defaults to 900 seconds (OPENSHELL_SMOKE_TIMEOUT_SECS). |
| 25 | + |
| 26 | +on: |
| 27 | + workflow_dispatch: |
| 28 | + schedule: |
| 29 | + # Avoid minute zero, when GitHub scheduled jobs are busiest. |
| 30 | + - cron: "17 4 * * 1" |
| 31 | + pull_request: |
| 32 | + paths: |
| 33 | + - "packages/openshell/**" |
| 34 | + - "apps/server/src/environment/**" |
| 35 | + - "scripts/openshell-smoke.ts" |
| 36 | + - ".github/workflows/openshell-smoke.yml" |
| 37 | + |
| 38 | +permissions: |
| 39 | + contents: read |
| 40 | + |
| 41 | +concurrency: |
| 42 | + group: openshell-smoke-${{ github.event.pull_request.number || github.sha }} |
| 43 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 44 | + |
| 45 | +jobs: |
| 46 | + smoke: |
| 47 | + name: Gateway smoke |
| 48 | + runs-on: ubuntu-24.04 |
| 49 | + timeout-minutes: 25 |
| 50 | + steps: |
| 51 | + # Same presence pattern as the EXPO_TOKEN check in mobile-eas-production.yml. |
| 52 | + - id: smoke-secrets |
| 53 | + name: Check for gateway secrets |
| 54 | + env: |
| 55 | + SMOKE_URL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_URL }} |
| 56 | + SMOKE_CREDENTIAL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_CREDENTIAL }} |
| 57 | + run: | |
| 58 | + if [ -n "$SMOKE_URL" ] && [ -n "$SMOKE_CREDENTIAL" ]; then |
| 59 | + echo "present=true" >> "$GITHUB_OUTPUT" |
| 60 | + else |
| 61 | + echo "present=false" >> "$GITHUB_OUTPUT" |
| 62 | + echo "OPENSHELL_SMOKE_GATEWAY_URL and OPENSHELL_SMOKE_GATEWAY_CREDENTIAL are not configured; skipping the live gateway smoke." |
| 63 | + fi |
| 64 | +
|
| 65 | + - name: Checkout |
| 66 | + if: steps.smoke-secrets.outputs.present == 'true' |
| 67 | + uses: actions/checkout@v6 |
| 68 | + |
| 69 | + - name: Setup Vite+ |
| 70 | + if: steps.smoke-secrets.outputs.present == 'true' |
| 71 | + uses: ./.github/actions/setup-ci-deps |
| 72 | + with: |
| 73 | + task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }} |
| 74 | + |
| 75 | + # The SDK (@nvidia/openshell-sdk) ships via GitHub Packages only, so it is |
| 76 | + # installed into a throwaway directory with a per-run .npmrc and symlinked |
| 77 | + # into the gitignored node_modules. Nothing enters package.json, the |
| 78 | + # pnpm lockfile, or any committed file; the token is masked and never printed. |
| 79 | + - name: Install the OpenShell SDK into a scratch directory |
| 80 | + if: steps.smoke-secrets.outputs.present == 'true' |
| 81 | + env: |
| 82 | + OPENSHELL_SMOKE_NPM_TOKEN: ${{ secrets.OPENSHELL_SMOKE_NPM_TOKEN }} |
| 83 | + run: | |
| 84 | + echo "::add-mask::$OPENSHELL_SMOKE_NPM_TOKEN" |
| 85 | + scratch="$(mktemp -d)" |
| 86 | + printf '{\n "name": "openshell-smoke-sdk",\n "private": true\n}\n' > "$scratch/package.json" |
| 87 | + cat > "$scratch/.npmrc" <<'NPMRC' |
| 88 | + @nvidia:registry=https://npm.pkg.github.com |
| 89 | + //npm.pkg.github.com/:_authToken=${OPENSHELL_SMOKE_NPM_TOKEN} |
| 90 | + always-auth=true |
| 91 | + NPMRC |
| 92 | + # 0.1.7 is the version packages/openshell pins in its SDK-mirror comment. |
| 93 | + (cd "$scratch" && npm install --no-save --ignore-scripts "@nvidia/openshell-sdk@0.1.7") |
| 94 | + mkdir -p node_modules/@nvidia |
| 95 | + ln -sfn "$scratch/node_modules/@nvidia/openshell-sdk" node_modules/@nvidia/openshell-sdk |
| 96 | +
|
| 97 | + - name: Run the gateway smoke |
| 98 | + if: steps.smoke-secrets.outputs.present == 'true' |
| 99 | + env: |
| 100 | + OPENSHELL_SMOKE_GATEWAY_URL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_URL }} |
| 101 | + OPENSHELL_SMOKE_GATEWAY_CREDENTIAL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_CREDENTIAL }} |
| 102 | + OPENSHELL_SMOKE_TEMPLATE: ${{ vars.OPENSHELL_SMOKE_TEMPLATE }} |
| 103 | + run: node scripts/openshell-smoke.ts |
0 commit comments