diff --git a/.github/workflows/monitor-vsix.yml b/.github/workflows/monitor-vsix.yml new file mode 100644 index 00000000..43fe5255 --- /dev/null +++ b/.github/workflows/monitor-vsix.yml @@ -0,0 +1,103 @@ +# Packages the session monitor VS Code extension and attaches it to the release. +# +# The IDE image (EduIDE) installs this by URL from a release asset, the same way it +# installs data-bridge. Nothing else builds node/monitor, so the pull_request trigger +# exists to catch a broken package before a release depends on it. +name: Monitor VSIX + +on: + pull_request: + branches: + - main + paths: + - 'node/monitor/**' + - '.github/workflows/monitor-vsix.yml' + + release: + types: + - published + - prereleased + + workflow_dispatch: + inputs: + version: + description: "Version to stamp into the vsix (e.g. 1.2.0). Defaults to the manifest version." + required: false + default: "" + type: string + +permissions: + contents: read + +jobs: + package: + name: Package + runs-on: ubuntu-latest + defaults: + run: + working-directory: node/monitor + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + # The release tag is vX.Y.Z; a vsix version must be X.Y.Z. Same normalisation the + # image build does, and for the same reason - one release is one version string. + - name: Resolve version + id: version + shell: bash + run: | + set -euo pipefail + RAW="${{ github.event_name == 'release' && github.event.release.tag_name || inputs.version }}" + if [ -n "$RAW" ]; then + echo "VERSION=${RAW#v}" >> "$GITHUB_OUTPUT" + else + echo "VERSION=" >> "$GITHUB_OUTPUT" + fi + + - name: Stamp version + if: steps.version.outputs.VERSION != '' + run: npm version "${{ steps.version.outputs.VERSION }}" --no-git-tag-version --allow-same-version + + - name: Install dependencies + run: npm install --no-audit --no-fund + + # vsce runs `vscode:prepublish` (webpack --mode production) itself, so the bundle + # in the vsix is always built from this checkout. + - name: Package VSIX + run: npx vsce package --allow-star-activation --skip-license --out theia-cloud-monitor.vsix + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: theia-cloud-monitor-vsix + path: node/monitor/theia-cloud-monitor.vsix + if-no-files-found: error + + release-asset: + name: Attach to release + if: github.event_name == 'release' + needs: package + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + name: theia-cloud-monitor-vsix + path: . + + # Named with the version, so the URL in EduIDE's package.json.patch pins one build. + - name: Attach to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.event.release.tag_name }} + shell: bash + run: | + set -euo pipefail + VERSION="${TAG#v}" + mv theia-cloud-monitor.vsix "theia-cloud-monitor-${VERSION}.vsix" + gh release upload "$TAG" "theia-cloud-monitor-${VERSION}.vsix" --clobber \ + --repo "${{ github.repository }}" diff --git a/AGENTS.md b/AGENTS.md index 6070dc10..805e0508 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -57,10 +57,11 @@ There is **no `npm run test`**. The Playwright suite is ## No CI runs the tests -`.github/workflows/` has three files: `build.yml` (three images, via the shared -org workflow), `tag-format.yml`, `auto-assign.yml`. **Nothing runs `mvn test`, -`npm run lint` or anything under `theia/`.** `dockerfiles/service/Dockerfile` -even builds with `-Dmaven.test.skip=true`. +`.github/workflows/` builds and packages, and never tests: `build.yml` (three +images, via the shared org workflow), `monitor-vsix.yml` (the monitor extension), +`tag-format.yml`, `dependency-review.yml`, `docs-check.yml`, `auto-assign.yml`. +**Nothing runs `mvn test`, `npm run lint` or anything under `theia/`.** +`dockerfiles/service/Dockerfile` even builds with `-Dmaven.test.skip=true`. A PR that breaks a Java test goes green. Run the tests yourself: @@ -72,6 +73,32 @@ cd java/service/org.eclipse.theia.cloud.service && mvn verify two (`SidecarConfigTests`, `PrewarmedResourcePoolTests`); `conversion` and `defaultoperator` have none. +## The session monitor ships as a release asset, not an image + +`node/monitor` is the VS Code extension that answers the operator's activity +polls - `GET /monitor/activity/lastActivity`, `POST /monitor/activity/popup` and +`POST /monitor/message`, on `THEIACLOUD_MONITOR_PORT`, authenticated with +`THEIACLOUD_SESSION_SECRET`. Without it in the session image, the operator's +`MonitorActivityTracker` polls something that does not answer. + +`monitor-vsix.yml` packages it on every release and attaches +`theia-cloud-monitor-.vsix` to that release. The EduIDE image consumes +it by URL from its own base-IDE plugin list, exactly as it consumes data-bridge. +Nothing publishes it to a marketplace. + +**`publisher` is load-bearing.** `vsce package` refuses to run without one - the +`build:vsix` script predates it being set and could never have worked as shipped. +It is `tum-aet`, matching data-bridge, so the extension id is +`tum-aet.theia-cloud-monitor`. + +**The monitor needs a port of its own.** `appDefinitions.defaults.monitor.port` +in EduIDE-Helm must not equal the app port: the operator drops the dedicated +Service port when they match, and the poll then goes to the Service's `http` +port, which targets oauth2-proxy and can never return 200. + +`node/monitor` is deliberately NOT in `node/package.json`'s workspaces. It +installs and packages on its own. + ## Rules that are easy to get wrong **Ephemeral sessions are rejected only when a sidecar MOUNTS THE WORKSPACE** — diff --git a/node/.gitignore b/node/.gitignore index 9b047dd6..d6b35cad 100644 --- a/node/.gitignore +++ b/node/.gitignore @@ -2,3 +2,6 @@ node_modules lib build dist + +# Packaged VS Code extensions, produced by `npm run build:vsix` in monitor/ +*.vsix diff --git a/node/monitor/package.json b/node/monitor/package.json index 81e80aa6..ffcbdff5 100644 --- a/node/monitor/package.json +++ b/node/monitor/package.json @@ -1,5 +1,6 @@ { "name": "theia-cloud-monitor", + "publisher": "tum-aet", "displayName": "Theia Cloud Monitor extension", "description": "Monitor for Theia Cloud hosted tools", "version": "1.2.0-next",