-
-
Notifications
You must be signed in to change notification settings - Fork 958
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
NFPMS build fails on windows #2068
Comments
hmm, seems to be an issue on fileglob, thanks for reporting 🙏 |
Seeing the same issue. I'd really like to use the recent version of goreleaser because of https://github.com/kopia/kopia/runs/1996818039?check_suite_focus=true Can you prioritize fixing this? |
I'm already looking into it, |
can you try with v0.158? |
that did not help: https://github.com/kopia/kopia/runs/2009486429?check_suite_focus=true ⨯ release failed after 47.11s error=invalid nfpm config: glob failed: D:\a\kopia\kopia\dist\kopia_linux_arm64\kopia: stat static prefix D:/D:akopiakopiadistkopia_linux_arm64kopia: open D:akopiakopiadistkopia_linux_arm64kopia: invalid argument It is different than previous failure: ⨯ release failed after 40.64s error=invalid nfpm config: matching "D:akopiakopiadistkopia_linux_arm_6kopia": file does not exist |
ok, will try to dig into it when I have some time... |
may I ask why you are releasing from windows? (curious because you seem to test on other OSes as well) |
also worth nothing: #1947 (comment) |
Actually I'm not releasing on windows (using This is slightly outdated artifact pipeline for my app: But since you asked: What I'd really like would be some ability to override parts of YAML via command line (without having to maintain 3 different goreleaser yaml for each OS), so that I can decide which sections of the config to use/ignore based on flags. This way on Windows/Mac I can skip the whole RPM/DEB mess which I don't really need. Going forward when running on macOS and Windows I'd like to do additional signing steps and notarization (completely different for each OS). Also on a mac I'd want to produce fat binary which has both amd64 and darwin64 in it (requires |
Got it. We already have an issue for fat binaries on macos, but honestly, I don't think we'll have a way to skip parts of the config via flags, as it would become fairly complex real quick as well.
Doing it on a single file would make it even worse... |
But I can’t break the release process into smaller units today, can I? For example to only run the packaging (rpm and deb) without also running the compiler, hooks, etc. Or to run the just signing of binaries that have been prebuilt. |
no you can't, but that shouldn't be an issue if you share go cache |
FYI: I'm going to disable goreleaser on windows and mac (linux will remain as-is for now) and will switch to makefile script on those platforms. |
Hi @caarlos0, I think this could help. goreleaser/nfpm -> goreleaser/fileglob -> gobwas/glob -> https://github.com/gobwas/glob/blob/e7a84e9525fe90abcda167b604e483cc959ad4aa/syntax/lexer/lexer.go#L243 func (l *lexer) fetchText(breakers []rune) {
var data []rune
var escaped bool
reading:
for {
r := l.read()
if r == eof {
break
}
if !escaped {
if r == char_escape { // char_escape = "\\"
escaped = true
continue
}
if runes.IndexRune(breakers, r) != -1 {
l.unread()
break reading
}
}
escaped = false
data = append(data, r)
}
if len(data) > 0 {
l.tokens.push(Token{Text, string(data)})
}
} This function is skipping windows path separators "\\" so if the token was "C:\\Users\\test\\desktop", after fetchText() it's "C:Userstestdesktop". In goreleaser/fileglob this last is used to do a system call and there's where it fails. file: https://github.com/goreleaser/fileglob/blob/main/glob.go#L116 ...
pattern = strings.TrimSuffix(...) // "C:\\Users\\test\\desktop"
matcher, err := glob.Compile(pattern, separatorRune) // Here's where fetchText() is called
if err != nil {
return matches, fmt.Errorf("compile glob pattern: %w", err)
}
// pattern is now "C:Userstestdesktop"
prefix, err := staticPrefix(pattern)
if err != nil {
return nil, fmt.Errorf("cannot determine static prefix: %w", err)
}
// prefix = "C:Userstestdesktop"
prefixInfo, err := fs.Stat(options.fs, prefix) // System call to "C:Userstestdesktop"
if errors.Is(err, fs.ErrNotExist) {
if !ContainsMatchers(pattern) {
return []string{}, fmt.Errorf(`matching "%s%s": %w`, options.prefix, prefix, fs.ErrNotExist) // This is the error that @Niondir got
}
return []string{}, nil
}
... The author suggests using QuoteMeta() to compile but I got the same error with it. Related issues: |
Thanks @GGP1 ! I think we just need to call |
I can confirm it now builds successfully on Windows. |
Amazing, thanks for verifying 🙏 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug
On windows the build fails with:
release failed after 9.09s error=invalid nfpm config: matching "C:devgopathsrcgithub.comlobaromy-projectbuildmy-project_linux_amd64my-project": file does not exist
To Reproduce
Steps to reproduce the behavior:
Additional context
Works in CI on linux
The text was updated successfully, but these errors were encountered: