8000 Build multi version docs in isolated uv environments by NickCao · Pull Request #483 · jumpstarter-dev/jumpstarter-python · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Build multi version docs in isolated uv environments#483

Merged
mangelajo merged 1 commit intomainfrom
multiversion
May 13, 2025
Merged

Build multi version docs in isolated uv environments#483
mangelajo merged 1 commit intomainfrom
multiversion

Conversation

@NickCao
Copy link
Collaborator
@NickCao NickCao commented May 13, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a script to automate building documentation for multiple branches.
  • Removals

    • Removed the sidebar section displaying documentation versions.
    • Removed all configuration and dependencies related to multi-version documentation support.
  • Chores

    • Simplified the documentation build process by delegating multi-version logic to an external script.
    • Minor formatting improvements to project files.

@netlify
Copy link
netlify bot commented May 13, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 6e8055f
🔍 Latest deploy log https://app.netlify.com/sites/jumpstarter-docs/deploys/68236dd81f93dc000843aac0
😎 Deploy Preview https://deploy-preview-483--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@coderabbitai
Copy link
Contributor
coderabbitai bot commented May 13, 2025

Walkthrough

This update removes the use of the sphinx-multiversion extension from the documentation build process, deletes its configuration and sidebar template, and introduces a custom Bash script (multiversion.sh) to handle multi-version documentation builds. The Makefile and dependencies are updated accordingly, and minor formatting adjustments are applied.

Changes

File(s) Change Summary
.gitignore Added a missing newline at the end of the file.
docs/Makefile Simplified the multiversion target to call a new external script; added newline at end of file.
docs/multiversion.sh New Bash script introduced to automate multi-version documentation builds across specified branches.
docs/source/_templates/sidebar/versions.html Deleted the sidebar HTML template for displaying documentation versions.
docs/source/conf.py Removed all configuration related to sphinx-multiversion, including extension, sidebar, and context variables.
pyproject.toml Removed the sphinx-multiversion dependency from the documentation dependencies group.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant multiversion.sh
    participant Git
    participant Sphinx
    participant Versjon

    User->>Makefile: make multiversion
    Makefile->>multiversion.sh: Execute script
    multiversion.sh->>Git: Create worktree for branch
    multiversion.sh->>Sphinx: Build docs for branch
    Sphinx-->>multiversion.sh: HTML output
    multiversion.sh->>Git: Remove worktree
    multiversion.sh->>Versjon: Generate version index
    multiversion.sh-->>Makefile: Complete
Loading

Possibly related PRs

  • jumpstarter-dev/jumpstarter#400: Modifies the multiversion Makefile target by changing how the main directory contents are handled, related to the simplification of the multiversion target in this PR.

Poem

In the docs a new script hops,
Multiversion builds—no more stops!
Sidebar versions now retire,
Sphinx-multiversion we no longer require.
With Bash and branches, we now ascend,
To clearer docs—onward, my friend!
🐇✨


📜 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 0c38b26 and 6e8055f.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • docs/Makefile (1 hunks)
  • docs/multiversion.sh (1 hunks)
  • docs/source/_templates/sidebar/versions.html (0 hunks)
  • docs/source/conf.py (0 hunks)
  • pyproject.toml (0 hunks)
💤 Files with no reviewable changes (3)
  • pyproject.toml
  • docs/source/_templates/sidebar/versions.html
  • docs/source/conf.py
✅ Files skipped from review due to trivial changes (3)
  • .gitignore
  • docs/multiversion.sh
  • docs/Makefile
✨ 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: 1

🧹 Nitpick comments (2)
docs/multiversion.sh (2)

21-24: Copy and cleanup per-branch output
Recursive cp and git worktree remove are appropriate here. Optionally, rsync -a could offer finer control over file attributes and partial updates.


26-28: Generate version index using versjon
Running uvx versjon in the output directory is a neat way to build the version index. For reproducibility, you might pin the versjon tool version or commit hash.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37dee82 and 0c38b26.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • docs/Makefile (1 hunks)
  • docs/multiversion.sh (1 hunks)
  • docs/source/_templates/sidebar/versions.html (0 hunks)
  • docs/source/conf.py (0 hunks)
  • pyproject.toml (0 hunks)
💤 Files with no reviewable changes (3)
  • pyproject.toml
  • docs/source/_templates/sidebar/versions.html
  • docs/source/conf.py
🧰 Additional context used
🪛 GitHub Actions: documentation
docs/Makefile

[error] 29-29: Git worktree add failed with 'fatal: invalid reference: main'. The branch 'main' does not exist or is not accessible.


[error] 51-51: Make target 'docs-all' failed due to previous error in 'multiversion' target.

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: pytest-matrix (macos-15, 3.13)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
  • GitHub Check: e2e
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-dev .devfile/Containerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
🔇 Additional comments (7)
.gitignore (1)

166-166: Skip formatting-only change.
The added trailing newline does not affect any ignore rules or logic.

docs/Makefile (2)

28-30: Simplified multiversion target usage
Invoking the external script multiversion.sh is a clean abstraction over the previous inline commands. Ensure that docs/multiversion.sh is present and has the executable bit set (chmod +x).

🧰 Tools
🪛 GitHub Actions: documentation

[error] 29-29: Git worktree add failed with 'fatal: invalid reference: main'. The branch 'main' does not exist or is not accessible.


33-33: Skip formatting-only change.
The added newline in the serve-multiversion target is purely cosmetic.

docs/multiversion.sh (4)

1-2: Validate strict mode settings
Using the bash shebang with set -euox pipefail is an excellent practice to catch errors early and improve script robustness.


7-9: Resolve script and output directory paths robustly
Calculating SCRIPT_DIR and deriving OUTPUT_DIR relative to the script makes the layout portable and self-contained.


10-12: Ensure clean build directory
Removing and recreating the build directory at the start guarantees no stale artifacts carry over between runs.


13-20: Loop through branches to build docs
Using git worktree add --detach with a per-branch make html and version override is a clear and maintainable approach.

Comment on lines +4 to +5
declare -a BRANCHES=("main" "release-0.5" "release-0.6")

Copy link
Contributor
@coderabbitai coderabbitai bot May 13, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Handle default branch detection dynamically
Hardcoding "main" will fail if the repository’s default branch is named differently (e.g., master), as shown by the CI error fatal: invalid reference: main. Consider auto-detecting the default branch:

- declare -a BRANCHES=("main" "release-0.5" "release-0.6")
+ DEFAULT_BRANCH=$(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's|origin/||')
+ declare -a BRANCHES=("$DEFAULT_BRANCH" "release-0.5" "release-0.6")
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
declare -a BRANCHES=("main" "release-0.5" "release-0.6")
# replace the hard-coded “main” with whatever the remote’s HEAD points to
DEFAULT_BRANCH=$(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's|origin/||')
declare -a BRANCHES=("$DEFAULT_BRANCH" "release-0.5" "release-0.6")

Copy link
Member

Choose a reason for hiding this comment

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

This script is not generic, just for our repo, the extra complexity is not worth it

Copy link
Member

Choose a reason for hiding this comment

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

This script is not generic, just for our repo, the extra complexity is not worth it

Copy link
Contributor

Choose a reason for hiding this comment

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

@mangelajo I understand your point. Since the script is specific to your repository, keeping it simple without the additional dynamic branch detection makes sense. I'll accept your decision and won't pursue this suggestion further.


✏️ Learnings added
Learnt from: mangelajo
PR: jumpstarter-dev/jumpstarter#483
File: docs/multiversion.sh:4-5
Timestamp: 2025-05-13T18:08:55.245Z
Learning: The script `docs/multiversion.sh` is intentionally repository-specific and not meant to be generic. The hardcoded branches ("main", "release-0.5", "release-0.6") are deliberate, and suggestions to make the script more generic by dynamically detecting branches should be avoided.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mangelajo Understood! You're right that if the script is specific to this repository and not meant to be generic, keeping it simple makes sense. Thanks for the clarification.


✏️ Learnings added
Learnt from: mangelajo
PR: jumpstarter-dev/jumpstarter#483
File: docs/multiversion.sh:4-5
Timestamp: 2025-05-13T18:08:55.371Z
Learning: The multiversion.sh script in the docs directory is intentionally repository-specific with hardcoded branch names (including "main") and doesn't need to handle varying default branch names. Adding complexity for generalization isn't necessary.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@NickCao NickCao marked this pull request as draft May 13, 2025 15:56
@NickCao NickCao marked this pull request as ready for review May 13, 2025 16:44

cp -r "${WORKTREE}/docs/build/html" "${OUTPUT_DIR}/${BRANCH}"

git worktree remove --force "${WORKTREE}"
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know about work tree

@mangelajo mangelajo merged commit 758b0e3 into main May 13, 2025
22 checks passed
@mangelajo mangelajo deleted the multiversion branch May 13, 2025 18:09
@NickCao NickCao added the backport release-0.6 Backport PR to release-0.6 branch label May 13, 2025
@jumpstarter-backport-bot
Copy link

Backport failed for release-0.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.6
git worktree add -d .worktree/backport-483-to-release-0.6 origin/release-0.6
cd .worktree/backport-483-to-release-0.6
git switch --create backport-483-to-release-0.6
git cherry-pick -x 6e8055fd4064fa581bf4a74e33a8310b9f1877da

@NickCao NickCao added backport release-0.6 Backport PR to release-0.6 branch and removed backport release-0.6 Backport PR to release-0.6 branch labels May 13, 2025
@jumpstarter-backport-bot
Copy link

Backport failed for release-0.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.6
git worktree add -d .worktree/backport-483-to-release-0.6 origin/release-0.6
cd .worktree/backport-483-to-release-0.6
git switch --create backport-483-to-release-0.6
git cherry-pick -x 6e8055fd4064fa581bf4a74e33a8310b9f1877da

mangelajo added a commit that referenced this pull request May 13, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport release-0.6 Backport PR to release-0.6 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0