Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for the owl landing in v2 #1751

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ updates:
open-pull-requests-limit: 10
versioning-strategy: increase
ignore:
# we want to update this package manually as it changes
# the minimum required VS Code version for this extension
# to run
- dependency-name: "@types/vscode"
# we want to update this package manually as we don't have
# any influence which Node.js version VS Code uses
- dependency-name: "@types/node"
# ESM only packages we can't update since VS Code doesn't
# support ESM yet
- dependency-name: "got"
Expand All @@ -25,6 +18,8 @@ updates:
- dependency-name: "@octokit/rest"
# it breaks wdio-vscode-service
- dependency-name: "vscode-uri"
# Deprecated
- dependency-name: "@vercel/client"
groups:
aws-sdk:
patterns:
Expand Down
26 changes: 16 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $ cp -f "assets/$EXTENSION_BASENAME-icon.gif" "assets/icon.gif"
$ cp -f "assets/$EXTENSION_BASENAME-logo-open-dark.svg" "assets/logo-open-dark.svg"
$ cp -f "assets/$EXTENSION_BASENAME-logo-open-light.svg" "assets/logo-open-light.svg"
$ cp -f "assets/$EXTENSION_BASENAME-logo-sidebar.svg" "assets/logo-sidebar.svg"
$ npm install --include=dev
$ NODE_OPTIONS='' npm install --include=dev
```

Similarly a Runme WASM binary needs to be downloaded. If an error happened follow the error instructions and re-run the download, via:
Expand Down Expand Up @@ -136,6 +136,14 @@ If you want to run the extension against a specific runme kernel binary, you can
}
```

### Upgrade kernel dependencies

To upgrade the kernel gRPC dependencies, you can run the following command. Be sure to release the `runme` kernel binary before a stable merge/release.

```sh {"background":"false","id":"01JAQYD2R3KN63QZ7EC2T2AB58"}
npm install -s "@buf/stateful_runme.community_timostamm-protobuf-ts@latest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, no name is intentional. It's not a frequent-enough task.

```

### Debug Project

To run the extension in a new Extension Development Host window of VS Code open [src/extension/extension.ts](src/extension/extension.ts) inside VSCode, press `F5` or `Ctrl+Shift+D` and then select `Run Extension` from the dropdown.
Expand Down Expand Up @@ -279,14 +287,6 @@ echo "Running test:e2e:reconcile ✅"

If you cancel the running test at any time, make sure to run this command before continuing development.

### Release

You can use following Github Actions workflow to release both edge (pre-release) and stable versions of the Runme's VS Code extension. This will package, test, and upon success push a new build of the extension to Microsoft's VS Code marketplace as well as OpenVSX.

```sh {"id":"01HF7VQMH8ESX1EFV4Q8N8Z85Z"}
https://github.com/stateful/vscode-runme/actions/workflows/release.yml
```

### Commit messages

Your commit messages ideally can answer two questions: what changed and why. The subject line should feature the “what” and the body of the commit should describe the “why”.
Expand All @@ -295,7 +295,13 @@ When creating a pull request, its description should reference the corresponding

## Release Project

Contributor with push access to this repo can at any time make a release. To do so, just trigger the [GitHub Action](https://github.com/stateful/vscode-runme/actions?query=workflow%3A%22Manual+NPM+Publish%22) that releases the package. Ensure you pick the correct release type by following the [semantic versioning](https://semver.org/) principle.
You can use following Github Actions workflow to release both edge (pre-release) and stable versions of the Runme's VS Code extension. This will package, test, and upon success push a new build of the extension to Microsoft's VS Code marketplace as well as OpenVSX.

```sh {"id":"01HF7VQMH8ESX1EFV4Q8N8Z85Z"}
https://github.com/stateful/vscode-runme/actions/workflows/release.yml
```

Ensure you pick the correct release type by following the [semantic versioning](https://semver.org/) principle.

---

Expand Down
383 changes: 186 additions & 197 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 12 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,6 @@
"category": "Runme",
"description": "Lifecycle Identity - None"
},
{
"command": "runme.lifecycleIdentityAll",
"title": "Lifecycle Identity - All",
"category": "Runme",
"description": "Lifecycle Identity - All"
},
{
"command": "runme.lifecycleIdentityDoc",
"title": "Lifecycle Identity - Document",
Expand Down Expand Up @@ -1210,7 +1204,7 @@
"esmify": "echo '{ \"type\": \"module\" }' >> ./out/package.json",
"postinstall": "run-s postinstall:*",
"postinstall:wasm": "npm run download:wasm && npm run download:binary",
"postinstall:husky": "husky install",
"postinstall:husky": "husky",
"test": "runme run test",
"watch": "npm run build:dev -- --watch",
"vscode:prepublish": "npm run prepare-binary",
Expand All @@ -1232,13 +1226,13 @@
"@types/webpack-env": "^1.18.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitest/coverage-v8": "^2.1.2",
"@vitest/coverage-v8": "^2.1.3",
"@vscode/vsce": "^2.32.0",
"@wdio/cli": "^8.40.6",
"@wdio/local-runner": "^8.40.6",
"@wdio/mocha-framework": "^8.40.6",
"@wdio/spec-reporter": "^8.40.6",
"chromedriver": "^129.0.2",
"chromedriver": "^129.0.4",
"comment-json": "^4.2.5",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -1249,7 +1243,7 @@
"expect-webdriverio": "^4.15.4",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"husky": "^9.1.6",
"msw": "^2.4.9",
"msw": "^2.4.11",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"runme": "^3.1.0",
Expand All @@ -1268,19 +1262,19 @@
},
"dependencies": {
"@apollo/client": "^3.11.6",
"@aws-sdk/client-ec2": "^3.667.0",
"@aws-sdk/client-eks": "^3.667.0",
"@aws-sdk/credential-providers": "^3.667.0",
"@aws-sdk/client-ec2": "^3.670.0",
"@aws-sdk/client-eks": "^3.670.0",
"@aws-sdk/credential-providers": "^3.670.0",
"@buf/grpc_grpc.community_timostamm-protobuf-ts": "^2.9.4-20240904201038-e0425cfebb28.4",
"@buf/jlewi_foyle.bufbuild_es": "^1.10.0-20241002214001-8c67df189216.1",
"@buf/jlewi_foyle.connectrpc_es": "^1.5.0-20241002214001-8c67df189216.1",
"@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20240913234806-45813f39881a.4",
"@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20241021161352-11c142f88aee.4",
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-node": "^1.5.0",
"@connectrpc/connect-node": "^1.6.1",
"@google-cloud/compute": "^4.1.0",
"@google-cloud/container": "^5.17.0",
"@google-cloud/container": "^5.18.0",
"@google-cloud/run": "^1.4.0",
"@kubernetes/client-node": "^0.22.0",
"@kubernetes/client-node": "^0.22.1",
"@protobuf-ts/grpc-transport": "^2.9.1",
"@protobuf-ts/runtime": "^2.9.1",
"@protobuf-ts/runtime-rpc": "^2.9.1",
Expand Down Expand Up @@ -1312,7 +1306,7 @@
"ulidx": "^2.4.1",
"uuid": "^10.0.0",
"vscode-telemetry": "^1.0.2",
"yaml": "^2.5.1",
"yaml": "^2.6.0",
"zod": "^3.23.8"
}
}
32 changes: 0 additions & 32 deletions src/extension/events/envVarsChanged.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import { createDemoFileRunnerForActiveNotebook, createDemoFileRunnerWatcher } fr
import { GithubAuthProvider } from './provider/githubAuth'
import { StatefulAuthProvider } from './provider/statefulAuth'
import { IPanel } from './panels/base'
import { NotebookPanel as EnvStorePanel } from './panels/notebook'
import { EnvStorePanel } from './panels/notebook'
import { NotebookCellStatusBarProvider } from './provider/cellStatusBar/notebook'
import { SessionOutputCellStatusBarProvider } from './provider/cellStatusBar/sessionOutput'
import { GrpcReporter } from './reporter'
Expand Down Expand Up @@ -578,7 +578,7 @@ export class RunmeExtension {
return [
...runmePanelIds.map(register(appChannel, (id) => new CloudPanel(context, id))),
...notebookPanelIds.map(
register(notebookChannel, (id) => new EnvStorePanel(context, id, kernel.onVarsChangeEvent)),
register(notebookChannel, (id) => new EnvStorePanel(context, id, kernel.useMonitor())),
),
].flat()
}
Expand Down
4 changes: 4 additions & 0 deletions src/extension/grpc/runner/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export const CreateSessionRequestImpl = () => {
return v1.CreateSessionRequest
}

export const SessionEnvStoreSeedingEnum = () => {
return v2.CreateSessionRequest_Config_SessionEnvStoreSeeding
}

export const GetSessionRequestImpl = () => {
if (v2.matches(getServerRunnerVersion())) {
return v2.GetSessionRequest
Expand Down
26 changes: 12 additions & 14 deletions src/extension/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
import { TelemetryReporter } from 'vscode-telemetry'
import { UnaryCall } from '@protobuf-ts/runtime-rpc'
import { map } from 'rxjs/operators'
import { Subject } from 'rxjs'

import {
type ActiveTerminal,
Expand Down Expand Up @@ -102,12 +103,12 @@ import { handlePlatformApiMessage } from './messages/platformRequest'
import { handleGCPMessage } from './messages/gcp'
import { IPanel } from './panels/base'
import { handleAWSMessage } from './messages/aws'
import EnvVarsChangedEvent from './events/envVarsChanged'
import { SessionEnvStoreType } from './grpc/runner/v1'
import ContextState from './contextState'
import { uri as runUriResource } from './executors/resource'
import { CommandModeEnum } from './grpc/runner/types'
import { GrpcReporter } from './reporter'
import { EnvStoreMonitorWithSession } from './panels/notebook'

enum ConfirmationItems {
Yes = 'Yes',
Expand Down Expand Up @@ -145,12 +146,11 @@ export class Kernel implements Disposable {
protected reporter?: GrpcReporter
protected featuresState$?

readonly onVarsChangeEvent: EnvVarsChangedEvent
protected readonly monitor$ = new Subject<EnvStoreMonitorWithSession>()

constructor(protected context: ExtensionContext) {
const config = workspace.getConfiguration('runme.experiments')

this.onVarsChangeEvent = new EnvVarsChangedEvent()
this.#experiments.set('grpcSerializer', config.get<boolean>('grpcSerializer', true))
this.#experiments.set('grpcRunner', config.get<boolean>('grpcRunner', true))
this.#experiments.set('grpcServer', config.get<boolean>('grpcServer', true))
Expand Down Expand Up @@ -187,7 +187,7 @@ export class Kernel implements Disposable {
window.onDidChangeActiveColorTheme(this.#handleActiveColorThemeMessage.bind(this)),
window.onDidChangeActiveNotebookEditor(this.#handleActiveNotebook.bind(this)),
this.panelManager,
this.onVarsChangeEvent,
{ dispose: () => this.monitor$.complete() },
this.registerTerminalProfile(),
)

Expand Down Expand Up @@ -237,6 +237,10 @@ export class Kernel implements Disposable {
return getEnvProps(ext)
}

useMonitor() {
return this.monitor$.asObservable()
}

isFeatureOn(featureName: FeatureName): boolean {
if (!this.featuresState$) {
return false
Expand Down Expand Up @@ -1013,7 +1017,7 @@ export class Kernel implements Disposable {
workspaceRoot,
envStoreType,
// copy env from process naively for now
// later we might want a more sophisticated approach/to bring this server-side
// does this really make sense if kernel/client aren't on the same host?
envs: processEnviron(),
})

Expand All @@ -1026,15 +1030,9 @@ export class Kernel implements Disposable {
getRunnerSessionEnvs(this.context, runnerEnv, true, address),
)

const monitor = await this.runner.createMonitorEnvStore()
const streaming = monitor.monitorEnvStore(runnerEnv?.getSessionId())
streaming.responses.onMessage(({ data }) => {
if (data.oneofKind === 'snapshot') {
this.onVarsChangeEvent.dispatch(data.snapshot.envs)
}
})
streaming.responses.onError((err) => {
log.error('Error monitoring env store', err.message)
this.monitor$.next({
monitor: await this.runner.createMonitorEnvStore(),
sessionId: this.runnerEnv.getSessionId(),
})

// runs this last to not overwrite previous outputs
Expand Down
Loading