Skip to content

Conversation

@kstroobants
Copy link
Contributor

@kstroobants kstroobants commented Jul 17, 2025

Fixes #DXP-478

What

  • Removed try of npm update version in package.json during release CI workflow.
  • Added functions get_simulator_version and get_genvm_version to endpoints.py for retrieving version information.
  • Updated Dockerfile.backend to include git for version detection and added logic to capture version information and write it in a file. The DockerHub image should contain the version file (not tested).
  • Introduced a new VersionSection.vue component in the frontend to display version information in the settings tab at the bottom.
  • Updated SettingsView.vue to include the new VersionSection.
  • Modified IJsonRpcService.ts and JsonRpcService.ts to include methods for fetching studio and GenVM versions.
  • Frontend UI:
    Screenshot 2025-07-17 at 19 16 46
    Screenshot 2025-07-17 at 19 16 42

Why

To provide users with visibility into the current version of the simulator and GenVM, enhancing transparency and debugging capabilities.

Testing done

  • Verified that the version information is correctly captured in the Docker build process.
  • Tested the frontend to ensure the version information is displayed correctly in the VersionSection.
  • Confirmed that the RPC endpoints return the expected version data.

Decisions made

  • Decided to use git for studio version detection during the Docker build process to ensure accurate versioning. Reasoning about implementation options:
    • Copy .git + remove in dockerfile: Still leaves .git in Docker layers creating security risk
    • Build args with shell commands: Docker-compose doesn't execute $(git describe...), treats as literal string
    • Mount .git at runtime: Running containers get git access creating security risk
    • Version file commits: Creates dirty git history with automated commits
    • Package.json during release CI updates: Requires commits to update version, creates dirty history
    • Force push to main when creating a release: main branch is shared between devs
    • Separate branch for version text file: branches do not know which version they are on
    • Git notes: Still requires .git access in Dockerfile, doesn't solve core problem
    • Git hooks: Local only, not shared via repository, each dev needs setup. Hosting might not call git command after clone
    • Wrapper scripts: Requires ./start.sh instead of docker compose up
    • Manual version files: Violates "no hardcoded versions" requirement
    • Environment variables: Requires setting GIT_VERSION=... before docker-compose
    • Hardcoded versions: Static versions become outdated, manual maintenance required
    • Multi-stage builds: Could work but pre-stage takes too long to build.
    • Git directory mounting: Temporary git access during build only, no git data in final image, fast build time -> Final Solution

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

  • Focus on the new version retrieval logic in endpoints.py and the integration in the frontend components.
  • Ensure that the Dockerfile changes do not introduce any unintended side effects or security issues. Adding git is only done at the build phase so DockerHub should not contain git information.

User facing release notes

Added version display for the studio and GenVM in the settings section of the application.

Summary by CodeRabbit

  • New Features

    • Added a version section to the simulator settings, displaying "Studio" and "GenVM" version information in the frontend.
    • Backend now provides version details for both the simulator and GenVM, which are surfaced in the UI.
  • Chores

    • Embedded version information into the backend image during build for improved version reporting.
    • Updated build and release configurations to streamline dependency installation and remove unused npm publishing steps.

…s read the file; frontend calls the endpoints
@kstroobants kstroobants self-assigned this Jul 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

This update introduces backend and frontend support for displaying version information for both the Studio and GenVM components. Version data is extracted during the backend Docker build using Git metadata and an environment variable, then exposed via new RPC endpoints. The frontend consumes these endpoints, displaying the versions in the simulator settings UI.

Changes

File(s) Change Summary
backend/protocol_rpc/endpoints.py Added two RPC endpoints: get_simulator_version and get_genvm_version for version retrieval.
docker/Dockerfile.backend, .dockerignore Dockerfile updated to extract/write version info from Git and env; .git now allowed in build.
frontend/src/services/IJsonRpcService.ts, frontend/src/services/JsonRpcService.ts Added interface and implementation for fetching Studio and GenVM version via RPC.
frontend/src/components/Simulator/settings/VersionSection.vue, frontend/src/views/Simulator/SettingsView.vue Added new UI component and integrated it into the settings view to display version info.
.github/workflows/release-from-main.yml, release.config.js Removed @semantic-release/npm plugin and its install step from release workflow/config.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant Docker Build

    Docker Build->>Docker Build: Extract version from Git/env\nWrite to /app/version.txt

    User->>Frontend: Open Simulator Settings
    Frontend->>Backend: RPC getStudioVersion()
    Backend->>Backend: Read /app/version.txt (line 1)
    Backend-->>Frontend: Studio version string

    Frontend->>Backend: RPC getGenVMVersion()
    Backend->>Backend: Read /app/version.txt (line 2)
    Backend-->>Frontend: GenVM version string

    Frontend->>User: Display Studio & GenVM version in UI
Loading

Possibly related PRs

  • feat: update studio version through release process #1256: The main PR removes the @semantic-release/npm plugin and its installation from the release workflow, while the retrieved PR adds that same plugin and installation; thus, they make opposite changes to the same release configuration and workflow files.

Suggested reviewers

  • cristiam86

Poem

🐇
In the garden of code where versions grow,
Now Studio and GenVM their numbers show.
From Docker’s build to frontend’s view,
The rabbit hops with something new!
With every tag and every line,
Versioning’s clear—oh how divine!
🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

coderabbitai[bot]

This comment was marked as resolved.

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.

2 participants