Conversation
…tall path - Add GetInstallDir() and GetTestInstallDir() functions - Check RAILPACK_MISE_DIR and RAILPACK_MISE_TEST_DIR env vars - Fallback to default /tmp/railpack/mise paths - Add .env.example documenting env vars
…geName - Normalize backslashes to forward slashes before splitting - Fix test to use hardcoded / instead of filepath.Separator - Ensures consistent behavior across platforms
…geName - Normalize backslashes to forward slashes before splitting - Fix test to use hardcoded / instead of filepath.Separator - Ensures consistent behavior across platforms
- golang: use path.Join for container copy commands - node: use path.Join for workspace glob patterns and package paths - Fixes Windows test failures in workspace pattern tests
iloveitaly
left a comment
There was a problem hiding this comment.
I'd love to better support Windows. Thanks so much for your contribution here.
Left a couple of comments since I really don't understand what the requirements are to get this running on Windows. One thing I would like to do if we're going to support Windows is try to run mise on a Windows machine. We should be able to do that through GitHub Actions
| // Create parent directories for the file | ||
| parentDir := filepath.Dir(cmd.Path) | ||
| // Use path.Dir for container paths (always forward slash) | ||
| parentDir := path.Dir(cmd.Path) |
There was a problem hiding this comment.
Why did you need to make this change?
There was a problem hiding this comment.
This function generates mkdir commands that will be executed inside the Linux container by BuildKit. When running railpack on Windows, filepath.Dir returns paths with backslashes, which are invalid in Linux. Using path.Dir ensures the mkdir instruction sent to BuildKit always uses forward slashes, regardless of the host OS.
I tested this by temporarily reverting to filepath.Dir then the build failed with mkdir /app/\etc\mise (backslash), then succeeded with path.Dir.
| // resolvePaths determines source and destination paths based on the include path and whether it's local. | ||
| // For local paths, only the basename is preserved when copying to /app directory. | ||
| // For container paths, the full relative path structure is preserved under /app. | ||
| // Note: Uses path.Join (not filepath.Join) for container paths to ensure forward slashes on all platforms. |
There was a problem hiding this comment.
The comment explains the technical reason (forward slashes), but let me clarify:
resolvePaths generates copy commands that BuildKit executes inside Linux containers. When running railpack on Windows, filepath.Join would create paths like /app\config\file.json (backslash), which are invalid in Linux. This causes BuildKit to fail when processing the copy instructions.
Using path.Join ensures all paths use forward slashes regardless of host OS, so the same build plan works on Windows, macOS, and Linux.
If you prefer clean code, i can remove that comment.
.env.example
Outdated
| @@ -0,0 +1,17 @@ | |||
| # Mise installation directories (Windows: use C:\tmp\railpack\mise) | |||
There was a problem hiding this comment.
This is not the right place to put these sort of variables. checkout the mise [env] config section.
| IdiomaticVersionFileTools = "python,node,ruby,elixir,go,java,yarn" | ||
| ) | ||
|
|
||
| // GetInstallDir returns the mise install directory, checking RAILPACK_MISE_DIR env var first |
There was a problem hiding this comment.
Could you help me understand why this is required?
There was a problem hiding this comment.
Windows doesn't have a /tmp directory. Without this env var, mise installation fails on Windows because the default path /tmp/railpack/mise doesn't exist and can't be created.
This allows Windows users to specify an alternative path like C:\tmp\railpack\mise. The env var is checked first, falling back to the default /tmp/railpack/mise on Unix systems.
Adds Windows compatibility for running railpack on Windows hosts.
Changes
Mise installation
RAILPACK_MISE_DIRandRAILPACK_MISE_TEST_DIRenv vars for custom install paths/tmp, so users can configure their own directory.env.examplePath handling
path.Joininstead offilepath.Joinfor container paths (always forward slash)getImageNameto handle both/and\separatorsTested on Windows
railpack inforailpack planrailpack buildNotes