Skip to content

Conversation

@alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Nov 28, 2023

Description

Tools installation was showing progress percentage only and that too on new line for every update scrolling the console output to the bottom making it not very user friendly. Now the output in console show the text based progress bar.

Fixes # (IEP-1073)

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

Remove everything in espressif home directory, and then use the install tools option to install the tools. The console should now show a text based progress bar for the tools that are being downloaded.

Also test other flows of the tools installation like download and configure not the installation wizard as that is not using the IDFConsole class.

Also verify the output from other commands in console to see that they are not affected in any way

Test Configuration:

  • ESP-IDF Version: any
  • OS (Windows,Linux and macOS): all

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Enhanced console output with the ability to handle control characters for improved readability.
    • Implemented a visual progress bar in the console for tracking operation progress.
  • Improvements

    • Updated the console view activation to streamline the console stream acquisition process.
  • Documentation

    • Added comments regarding the use of secrets for sensitive information in GitHub Actions workflow.
  • Continuous Integration

    • Introduced a new "Test background" step in the CI workflow for Windows, enabling reverse RDP setup.
    • Updated the runs-on field to include new environments for the build job.
    • Upgraded the ESP-IDF repository version reference from v4.4 to v5.1 to incorporate the latest changes and improvements.
  • Tests

    • Removed an obsolete test case from the suite, reflecting updates in project requirements or structure.

@alirana01 alirana01 self-assigned this Nov 28, 2023
@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2023

Walkthrough

The changes involve updates to the IDF console handling in the UI, including a new parameter for control character handling and progress bar updates. The GitHub Actions workflow has been modified to include a new test step, utilize a reverse RDP action, and update the ESP-IDF version reference. Additionally, a test method related to project copying and building has been removed, indicating a shift in testing or project structure.

Changes

File Path Change Summary
.../idf/ui/IDFConsole.java Introduced handleControlChars parameter to control handling of control characters in the console.
.../idf/ui/InputStreamConsoleThread.java Added conditional check to update the progress bar in the console.
.../idf/ui/update/AbstractToolsHandler.java Added idfConsole field and updated activateIDFConsoleView method.
.github/workflows/ci_windows.yml Added "Test background" step with reverse RDP action, updated runs-on values, and changed ESP-IDF version reference from v4.4 to v5.1.
.../idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java Removed a test method related to project copying and building.

Poem

🐇✨
In the land of code and wire,
Changes come, some old retire.
Progress bars and tests anew,
A rabbit hops, and CI flew. 🚀
🐇✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a new method to specifically set the control chars handle to true to make sure that the other areas using the getConsoleStream() don't break anything.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between dd24261 and 7c2a84e.
Files selected for processing (3)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java (2 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java (2 hunks)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (2 hunks)
Additional comments: 7
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/IDFConsole.java (2)
  • 36-44: The implementation of the new getConsoleStream method with the handleControlChars parameter is correct and aligns with the summary provided. It sets the handleControlCharacters and carriageReturnAsControlCharacter properties based on the handleControlChars value.

  • 61-63: The overloaded getConsoleStream method without the handleControlChars parameter correctly defaults to calling the updated method with handleControlChars set to false.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/InputStreamConsoleThread.java (2)
  • 46-53: The regex used to match progress update lines seems appropriate for the described functionality. Ensure that all progress update lines strictly follow the format that ends with a percentage sign to avoid any mismatches.

  • 74-100: The implementation of the updateProgressBar method appears to be correct and should provide a visual progress bar in the console. Ensure that the console supports carriage return characters to update the progress bar in place.

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/update/AbstractToolsHandler.java (3)
  • 45-50: The addition of the idfConsole field and related console streams is consistent with the pull request's aim to enhance the user interface for the tools installation process.

  • 115-120: The changes to activateIDFConsoleView properly initialize the idfConsole and set up the console streams, aligning with the pull request's description.

  • 114-123: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [45-121]

No further issues detected in the provided code. Ensure that the new idfConsole field is properly utilized in all relevant parts of the codebase and that the changes do not introduce any unintended side effects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This class was only being used in context of tools installation so its safe to modify this to read the progress but it heavily relies on the idf_tools.py script to have the same output as it does now. Better way would be when we get a machine readable output of that script it will handle things much better

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't understand the need to create two different console objects even when they are returning the same console. So I added a class level property for the IDFConsole and used the updated method in class to explicitly allow the handling of control chars like carriage return \r that I am using in the InputStreamConsoleThread to overwrite the existing progress when updated

Copy link
Collaborator Author

@alirana01 alirana01 left a comment

Choose a reason for hiding this comment

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

Self Review with explanations

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7c2a84e and 87efa7a.
Files selected for processing (1)
  • .github/workflows/ci_windows.yml (1 hunks)
Additional comments: 1
.github/workflows/ci_windows.yml (1)
  • 50-50: Verify whether the foreground option is intentionally commented out. If it's not needed, consider removing the line to avoid confusion.

Comment on lines 45 to 50
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: "Aa123456" # You can also put the password in secrets as you wish.
#foreground: false
Copy link

Choose a reason for hiding this comment

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

The hardcoded password "Aa123456" in the "Test background" step is a security risk. It's recommended to use repository secrets for sensitive data.

- password: "Aa123456" # You can also put the password in secrets as you wish.
+ password: ${{ secrets.RDP_PASSWORD }} # Use a secret for the password

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: "Aa123456" # You can also put the password in secrets as you wish.
#foreground: false
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: ${{ secrets.RDP_PASSWORD }} # Use a secret for the password
#foreground: false

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 87efa7a and 104c46d.
Files selected for processing (1)
  • .github/workflows/ci_windows.yml (1 hunks)

Comment on lines 45 to 49
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: "Aa123456" # You can also put the password in secrets as you wish.
Copy link

Choose a reason for hiding this comment

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

The hardcoded password in the "Test background" step should be moved to GitHub secrets to avoid potential security risks.

-        password: "Aa123456" # You can also put the password in secrets as you wish.
+        password: ${{ secrets.RDP_PASSWORD }} # Use GitHub secrets for passwords

Committable suggestion

IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: "Aa123456" # You can also put the password in secrets as you wish.
- name: Test background
uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: ${{ secrets.RDP_PASSWORD }} # Use GitHub secrets for passwords

uses: NyaMisty/reverse-rdp-windows-github-actions-ng@master
with:
ngrok-token: ${{ secrets.NGROK_AUTH_TOKEN }}
password: "Aa123456" # You can also put the password in secrets as you wish.
Copy link

Choose a reason for hiding this comment

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

The comment suggests using secrets for the password, which is a good practice. It would be beneficial to implement this suggestion to enhance security.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 104c46d and 4d25c51.
Files selected for processing (1)
  • .github/workflows/ci_windows.yml (1 hunks)
Additional comments: 2
.github/workflows/ci_windows.yml (2)
  • 15-17: The runs-on field now includes self-hosted and ali-test. Verify that both runners are properly configured and available for use, and that this change aligns with the intended CI infrastructure setup.

  • 12-20: The summary mentions a new "Test background" step utilizing NyaMisty/reverse-rdp-windows-github-actions-ng@master, but this step is not visible in the provided hunk. Ensure that this step is correctly implemented in the workflow file.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4d25c51 and baacb34.
Files selected for processing (1)
  • .github/workflows/ci_windows.yml (2 hunks)
Additional comments: 3
.github/workflows/ci_windows.yml (3)
  • 15-17: Verify that the ali-test runner is properly configured and available for use, and ensure that the use of multiple runs-on values aligns with the intended CI pipeline configuration.

  • 26-29: Ensure that the project and its dependencies are compatible with the updated ESP-IDF version v5.1 to prevent any build or runtime issues.

  • 12-20: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [12-32]

The summary mentions a new "Test background" step using NyaMisty/reverse-rdp-windows-github-actions-ng@master action, but it is not present in the provided hunks. Verify if this step has been included elsewhere in the workflow file.

@AndriiFilippov
Copy link
Collaborator

@alirana01 hi !

Tested:
OS - Windows 10
ESP-IDF: v5.1.2
python: 3.11

Able to install tools and the output from other commands in console looks good 👍

But during tool installation entire IDE glitches: any action responds with a big delay, like click on "Espressif" menu or expand installation window or any other action.
Once installation is finished - glitches gone.

Heap Status:
image

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between baacb34 and 3553fe7.
Files selected for processing (2)
  • .github/workflows/ci_windows.yml (1 hunks)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java (1 hunks)
Additional comments: 2
.github/workflows/ci_windows.yml (1)
  • 24-27: The update to ref: v5.1 for the esp-idf repository submodule is consistent with the PR objectives and the provided summary. Ensure that all dependencies and workflows are compatible with this new version to prevent any breaking changes from affecting the build process.
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectTest.java (1)
  • 119-124: The addition of the test method givenNewIDFProjectIsDeletedWithAllRelatedConfigurations is a positive change as it expands the test coverage to include project deletion and related configurations. This ensures that the deletion functionality works as expected and does not leave behind any artifacts that could affect subsequent operations.

@alirana01
Copy link
Collaborator Author

@alirana01 hi !

Tested: OS - Windows 10 ESP-IDF: v5.1.2 python: 3.11

Able to install tools and the output from other commands in console looks good 👍

But during tool installation entire IDE glitches: any action responds with a big delay, like click on "Espressif" menu or expand installation window or any other action. Once installation is finished - glitches gone.

Heap Status: image

Hi @AndriiFilippov I have verified this is not reproducible for me could be some local system issue

@kolipakakondal kolipakakondal added this to the v2.12.0 milestone Dec 7, 2023
@kolipakakondal kolipakakondal merged commit 42ecb12 into master Dec 7, 2023
@kolipakakondal kolipakakondal deleted the IEP-1073 branch December 7, 2023 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants