Skip to content

Enhance webapp version with build info #2146

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

Merged
merged 7 commits into from
Jun 4, 2025
Merged

Enhance webapp version with build info #2146

merged 7 commits into from
Jun 4, 2025

Conversation

nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Jun 3, 2025

Attach build info at deploy time and display it on the settings page. Cloud users will only see the app version, self-hosters will see the rest as well. This is very useful for debugging.

image

Copy link

changeset-bot bot commented Jun 3, 2025

⚠️ No Changeset found

Latest commit: e9f0fcf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

Walkthrough

This change introduces enhanced build metadata handling across the web application's build and deployment pipeline. The GitHub Actions workflow now sets and passes build metadata—such as version, commit SHA, reference name, and build timestamp—as build arguments to the Docker build process. The Dockerfile is updated to receive these arguments and expose them as environment variables in the final container. In the application code, a new BuildInfo type is defined and propagated through the loader and component props, replacing the previous simple version string. The user interface now conditionally displays detailed build metadata based on user role and deployment type.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30f4019 and e9f0fcf.

📒 Files selected for processing (2)
  • apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx (2 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx
  • apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: typecheck / typecheck
✨ 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.

Copy link
Contributor

@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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx (1)

111-134: Optimize date conversion and fix field name reference.

The conditional rendering and data formatting look good, but there are two improvements needed.

  1. Fix the field name reference to match the corrected type:
-        {showBuildInfo && buildInfo.buildTimestampSeonds && (
+        {showBuildInfo && buildInfo.buildTimestampSeconds && (
           <div className="flex flex-col gap-1">
             <SideMenuHeader title="Build timestamp" />
             <Paragraph variant="extra-small" className="px-2 text-text-dimmed">
-              {new Date(Number(buildInfo.buildTimestampSeonds) * 1000).toISOString()}
+              {new Date(Number(buildInfo.buildTimestampSeconds) * 1000).toISOString()}
             </Paragraph>
           </div>
         )}
  1. Consider memoizing the date conversion to avoid repeated computation:
import { useMemo } from 'react';

// Inside the component:
const formattedTimestamp = useMemo(() => {
  if (!buildInfo.buildTimestampSeconds) return null;
  return new Date(Number(buildInfo.buildTimestampSeconds) * 1000).toISOString();
}, [buildInfo.buildTimestampSeconds]);

// Then use: {formattedTimestamp}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eee0fb2 and 30f4019.

📒 Files selected for processing (4)
  • .github/workflows/publish-webapp.yml (2 hunks)
  • apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx (2 hunks)
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx (1 hunks)
  • docker/Dockerfile (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: units / internal / 📊 Merge Reports
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
docker/Dockerfile (1)

85-93: LGTM! Build metadata integration is well-implemented.

The Dockerfile correctly accepts build arguments and exposes them as environment variables in the final container. This follows Docker best practices and enables runtime access to build information.

.github/workflows/publish-webapp.yml (2)

59-68: LGTM! Build metadata collection is correctly implemented.

The conditional logic for setting BUILD_APP_VERSION only for semantic versions is appropriate, and the metadata collection using GitHub context variables is correct.


84-88: Build arguments properly passed to Docker.

The build arguments are correctly passed to the Docker build step, ensuring build metadata flows from the workflow to the container.

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx (2)

3-3: Good refactoring of import naming.

Renaming VERSION to coreVersion improves clarity and avoids naming conflicts with the new build info structure.


25-31: Component integration looks good.

The destructuring of buildInfo from loader data and passing it to the component is correctly implemented.

apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx (2)

44-45: Well-designed conditional display logic.

The showBuildInfo logic correctly shows detailed build information to admins or self-hosted users while hiding it from regular cloud users. This provides appropriate access control for sensitive build metadata.


108-108: Good fallback strategy for version display.

The version display logic properly prioritizes appVersion and falls back to packageVersion, ensuring a version is always shown.

nicktrn and others added 3 commits June 4, 2025 10:37
…ute.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…Menu.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@nicktrn nicktrn merged commit a619510 into main Jun 4, 2025
33 checks passed
@nicktrn nicktrn deleted the feat/webapp-version branch June 4, 2025 14:49
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