-
Notifications
You must be signed in to change notification settings - Fork 21
Very simple headlamp plugin, executes ie on a single document. No UI, No error checking, no niceties. But it works! #265
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
base: main
Are you sure you want to change the base?
Conversation
…re#202) This PR updates the regex used to find exported variables in a scenario that have more complex declarations (I.E. variables that get values from sub-shells, variables that are defined on the same line as another, etc). This PR fixes Azure#199 and tests have been added to ensure that this issue doesn't arise again.
…rts of the engine (Azure#198) This PR: * Updates `ie test` to use bubbletea for rendering it's output, similar to `ie interactive` and soon `ie execute`. * Refactors `ie interactive` and `ie test` implementations to exist in their own folders inside of `engine` (Which will be renamed to `ie` in the future). * Refactors code commonly used across execute, interactive, and test modes into a new package found in `internal/engine/common`. * Decoupled models from requiring a pointer to `Engine` as a parameter in preparation for when it will be deprecated in the future. * Reimplements `shells.ExecuteCodeBlock` to be a variable alias of `shells.executeCodeBlockImpl`. This allows for us to easily mock the the `ExecuteCodeBlock` implementation easily in tests. This allows us to do things like track calls to commands, record what commands were failed, mimic failures from executing commands, etc without having to actually execute commands. This is particularly useful in cases where we want to test the behavior of executing an Azure CLI command without actually executing the command itself. * Fixed an issue with the regex used to locate resource groups inside of command outputs and added tests to ensure that it works. * Adds a new environment `github-action`, specifically for running `ie test` inside of github actions runners. If this flag is not supplied, `ie test` will crash due to bubbletea attempting to open tty when there are no ttys available. (See actions/runner#241 for more information on GH actions not providing a TTY). *
…g `make test-upstream-scenarios` (Azure#205)
…ure#208) h1 headers are currently used to denote the title of the scenario being executed by IE and is currently made a requirement for the scenario to be executed. This PR allows for markdown documents to not specify h1 tags by falling back to using the markdown file name as the title of the scenario if no h1 tags are found within the document.
This PR updates the help strings for global flags on `ie` to make their usage clear and show what values that they can be passed in when running `ie -h` or `ie --help`.
…interactive mode (Azure#209) Updates interactive mode to include resource group URIs inside of the status JSON for parity with `ie execute`.
…a `--var` when running `ie test`. (Azure#210) This allows users to specify/override environment variables inside a markdown document by providing `--var KEY=VALUE` when running `ie test`. Both `execute` and `interactive` already support this feature and the implementation was ported over to `ie test`.
…eleted (Azure#211) This communicates the resource group that's being deleted if there is a resource group found at the end of `ie test`.
…kdown with `ie test --report <file-path>` (Azure#212) This PR adds test reporting to `ie test` when invoked with `--report=<report-name>`. The report format is currently in JSON, and an executable specification which dives more into the problem can now be found under `docs/specs/test-reporting.md`
Azure#217) This PR fixes `ie test` so that it exits with a failed status code when an error is encountered. This behavior was accidentally changed in `v0.2.0`, but was the default behavior prior to that.
This PR adds `m<number><enter>`, `a`, and `p` to interactive mode to allow a user to execute a specific number of steps, all remaining steps, or to pause execution in respective order.
…vironment variables that were used. (Azure#232) This PR updates `ie interactive` to overwrite the source of an executed document with the environment variables that were used and provide it to the portal before executing. These changes do not affect the standard execution and will not overwrite the actual document.
…cuted (Azure#233) This PR configures the markdown before executing interactive commands, as the final status updates happen before the interactive commands finish executing.
Attached github action and its instructions for automated testing of exec docs --------- Co-authored-by: root <root@DESKTOP-MJFFR09>
These two files should not be present on production code. Tiny cleanup.
Add Openssf's scorecard to the repo This tool will help with improving the security practices for the project.
… No error checking, no niceties. But it works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a minimal Innovation Engine Headlamp plugin with a Node.js/Express backend to run whitelisted shell commands and a React-based UI in Headlamp.
- Adds backend shell-exec service without UI niceties or security hardening
- Registers plugin routes and sidebar entries for “Getting Started” and shell execution
- Includes TypeScript config, documentation, and project scaffolding
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sandbox/innovation-engine-headlamp/tsconfig.json | TS config extending base Headlamp plugin settings |
| sandbox/innovation-engine-headlamp/src/shell-exec-backend.js | Express backend to execute whitelisted shell commands |
| sandbox/innovation-engine-headlamp/src/index.tsx | React components and Headlamp plugin API routes/sidebar entries |
| sandbox/innovation-engine-headlamp/specifications/execute-shell-command-via-backend-api.md | Markdown spec for shell-exec API flow |
| sandbox/innovation-engine-headlamp/package.json | Plugin metadata, dependencies, and scripts |
| sandbox/innovation-engine-headlamp/README.md | Usage instructions and security notes |
| sandbox/innovation-engine-headlamp/.gitignore | Ignored files (node_modules, logs) |
Comments suppressed due to low confidence (1)
sandbox/innovation-engine-headlamp/src/index.tsx:3
- The imports
registerRouteFilterandregisterSidebarEntryFilteraren’t used in this file. Removing them will clean up unused dependencies.
registerRouteFilter,
| setOutput(''); | ||
| setError(''); | ||
| try { | ||
| const res = await fetch('http://localhost:4000/api/exec', { |
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hardcoding http://localhost:4000; use a relative path (/api/exec) or a configurable base URL so the plugin works in different environments.
| const res = await fetch('http://localhost:4000/api/exec', { | |
| const res = await fetch(`${process.env.REACT_APP_API_BASE_URL || 'http://localhost:4000'}/api/exec`, { |
| @@ -0,0 +1,57 @@ | |||
| // Simple Node.js/Express backend for executing whitelisted shell commands | |||
| const express = require('express'); | |||
| const bodyParser = require('body-parser'); | |||
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Express has built-in JSON parsing via express.json(). You can remove the body-parser dependency and replace app.use(bodyParser.json()) with app.use(express.json()).
| const bodyParser = require('body-parser'); |
| app.use(cors()); | ||
| app.use(bodyParser.json()); | ||
|
|
||
| app.post('/api/exec', (req, res) => { |
Copilot
AI
May 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This endpoint allows unauthenticated requests to execute whitelisted commands. Consider adding authentication, authorization checks, or rate limiting to prevent misuse.
…ow to get Headlamp up and running locally
563052b to
aa86c6c
Compare
No description provided.