ROX-29845: Add start-console script to enable local plugin dev#16094
ROX-29845: Add start-console script to enable local plugin dev#16094
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Skipping CI for Draft Pull Request. |
|
Caution There are some errors in your PipelineRun template.
|
081487f to
0e16c8e
Compare
|
Images are ready for the commit at e835448. To use with deploy scripts, first |
88618e9 to
9c07abb
Compare
0e16c8e to
e6f96db
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16094 +/- ##
==========================================
- Coverage 48.69% 48.69% -0.01%
==========================================
Files 2606 2606
Lines 191776 191776
==========================================
- Hits 93388 93383 -5
- Misses 91058 91062 +4
- Partials 7330 7331 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e6f96db to
63646a8
Compare
9c07abb to
25da342
Compare
63646a8 to
1941fcb
Compare
25da342 to
e381ca8
Compare
dcf8a52 to
64d0116
Compare
64d0116 to
eff3e46
Compare
There was a problem hiding this comment.
Hey @dvail - I've reviewed your changes - here's some feedback:
- Consider adding a help flag and basic argument parsing to start-ocp-console.sh (e.g. --console-image, --port, --plugin) so users can easily customize settings without editing the script.
- Instead of hard-coding PLUGIN_NAME in the script, dynamically read it from package.json or allow an override via environment variable to support multiple plugins more easily.
- Add pre-flight checks at the top of start-ocp-console.sh to verify required commands (oc, podman/docker) are installed and that the user is logged in, failing fast with a clear error message if not.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding a help flag and basic argument parsing to start-ocp-console.sh (e.g. --console-image, --port, --plugin) so users can easily customize settings without editing the script.
- Instead of hard-coding PLUGIN_NAME in the script, dynamically read it from package.json or allow an override via environment variable to support multiple plugins more easily.
- Add pre-flight checks at the top of start-ocp-console.sh to verify required commands (oc, podman/docker) are installed and that the user is logged in, failing fast with a clear error message if not.
## Individual Comments
### Comment 1
<location> `ui/apps/platform/scripts/get-auth-token.sh:27` </location>
<code_context>
"${api_endpoint}/v1/apitokens/generate" \
-X POST \
- -d '{"name": "ui_tests", "role": "Admin"}' \
+ -d "{\"name\": \"${api_token_name}\", \"role\": \"${api_token_role}\"}" \
| jq -r '.token // ""')"
else
</code_context>
<issue_to_address>
Escaping JSON in shell can be error-prone if variables contain special characters.
If api_token_name or api_token_role includes quotes or backslashes, the JSON may become invalid. Use jq or a similar tool to safely build the JSON payload, especially if these variables are user-controlled.
</issue_to_address>
### Comment 2
<location> `ui/apps/platform/scripts/start-ocp-console.sh:5` </location>
<code_context>
+
+set -euo pipefail
+
+CONSOLE_IMAGE=${CONSOLE_IMAGE:="quay.io/openshift/origin-console:latest"}
+CONSOLE_PORT=${CONSOLE_PORT:=9000}
+CONSOLE_IMAGE_PLATFORM=${CONSOLE_IMAGE_PLATFORM:="linux/amd64"}
+
+# Plugin metadata is declared in package.json
</code_context>
<issue_to_address>
Default value assignment syntax is non-standard and may not work in all shells.
Use VAR="${VAR:-default}" for assignments to ensure POSIX compatibility across different shells.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
eff3e46 to
e835448
Compare
|
@dvail: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Adds the
start-ocp-console.shscript which runs a local version of the OCP console configured for plugin development.User-facing documentation
Testing and quality
Automated testing
Follow the steps described in the README changes and visit http://localhost:9000/security-TODO (placeholder URL)
