Closed hazendaz closed 2 years ago
Had a short look at maven manager. It uses it's own update function instead of the auto replace strategy.
We should refactor it to use auto replace, which should be easily doable.
@hazendaz Please create a minimal reproduction repo to test / debug against.
@viceice there's one thing holding back autoReplace - updates may need to be done in another file, not packageFile
. I plan to support this by letting a manager extract function return an optional field called editFile
which tells us which file to replace in if not the packageFile.
Also then need to think how to achieve autoReplace with extractAllPackageFiles()
@viceice Is there any difference in how this is handled from a perspective of running self-hosted vs using github integration? The reason I ask is that I set up an example using github integration and didn't see the problem. It could be that I just have not exposed it in the example I have. If these are to act the same, I'll dig more. If not, I'll get self-hosted working against github instead. Thanks in advance.
Here is the one I ran on github integration that worked fine for reference.
https://github.com/hazendaz/dependency-tracker/pull/520/files
It should be the same
@hazendaz Can you post the DEBUG
logs for the failed cli run?
@viceice @rarkins I re-titled this issue to more reflectively note what it is.
I got around this by running on a jenkins server on linux.
I'm unable to share the setup but its root cause seems pretty easy to understand and maybe be fixed.
Steps to reproduce
So my gut tells me that it's getting confused because I'm on windows, have a git attributes set to auto that should have carriage line feeds but they are using *nix line feeds. That count happens to add up to exactly how far down it decides to apply the offset version.
I've worked around the issue at this point and I'm up and running when entirely linux. Hopefully above is enough to go on that might help flush out the issue. The only thing this doesn't allow me to do currently is run this locally in this situation if I need so which is unlikely now for me personally. This may be useful for others though as my initial need was to setup it locally before messing with jenkins and trying to run on the cloud.
We can confirm the problem with the current version of Renovate (self-hosted on Windows). However, the workaround described here by @ngeor works like a charm:
$ git config --global core.autocrlf input
that sounds like the autoclrf windows problem with carriage return \r\n
,
please see:
https://github.com/renovatebot/renovate/blob/main/docs/development/best-practices.md#windows
@rarkins should we turn this into a discussion? or do you still wanna do a refactor of somekind?
If we have a way of fixing this automatically (such as setting autocrlf before cloning) then let's do it, otherwise we should just document it as a requirement for running Renovate on Windows (whether in dev or production)
the only way to resolve this is removing carriage returns manually right after cloning ,
i tried to look for a way or another library to git clone / checkout with atuocrlf
but i can't find any,
someone even asked a question in stack overflow for this
https://stackoverflow.com/questions/57916906/npm-package-lf-or-crlf-or-auto-line-endings
If we can't do it automatically, let's not do it and instead document it.
we have it documented in https://github.com/renovatebot/renovate/blob/main/docs/development/best-practices.md#windows
but we need it somewhere where everybody could read it,
@HonkingGoose can you help here? where do you think we should add this knowledge so that everybody can see it?
we have had over 5 tasks open on bad replacement location already and we always close them with this work around.
lets avoid extra issues.
I thought about opening a discussion and answering it so that people can see, but i'm not sure they know what to search for as
bad replacement location
-> Windows auto crlf
aren't aligned, we need like "Known Limitations" in documentation
@HonkingGoose can you help here? where do you think we should add this knowledge so that everybody can see it?
I'll go think about that a bit now.
we have had over 5 tasks open on bad replacement location already and we always close them with this work around. lets avoid extra issues.
If people keep opening issues, it means we're not documenting things properly. 😄
I thought about opening a discussion and answering it so that people can see, but i'm not sure they know what to search for as
bad replacement location
->Windows auto crlf
aren't aligned, we need like "Known Limitations" in documentation
Having a discussion with the answer in it would be nice to have as well. But the primary source should always be our documentation. Discussions can go stale/outdated, and people won't know that the answer might be wrong now.
We have a Known Limitations in our docs already.
core.autocrlf
feature of Git?Formatting and Whitespace
Formatting and whitespace issues are some of the more frustrating and subtle problems that many developers encounter when collaborating, especially cross-platform. It's very easy for patches or other collaborated work to introduce subtle whitespace changes because editors silently introduce them, and if your files ever touch a Windows system, their line endings might be replaced. Git has a few configuration options to help with these issues.
core.autocrlf
If you're programming on Windows and working with people who are not (or vice-versa), you'll probably run into line-ending issues at some point. This is because Windows uses both a carriage-return character and a linefeed character for newlines in its files, whereas macOS and Linux systems use only the linefeed character. This is a subtle but incredibly annoying fact of cross-platform work; many editors on Windows silently replace existing LF-style line endings with CRLF, or insert both line-ending characters when the user hits the enter key.
Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the
core.autocrlf
setting. If you're on a Windows machine, set it totrue
-- this converts LF endings into CRLF when you check out code:$ git config --global core.autocrlf true
If you're on a Linux or macOS system that uses LF line endings, then you don't want Git to automatically convert them when you check out files; however, if a file with CRLF endings accidentally gets introduced, then you may want Git to fix it. You can tell Git to convert CRLF to LF on commit but not the other way around by setting
core.autocrlf
to input:$ git config --global core.autocrlf input
This setup should leave you with CRLF endings in Windows checkouts, but LF endings on macOS and Linux systems and in the repository.
If you're a Windows programmer doing a Windows-only project, then you can turn off this functionality, recording the carriage returns in the repository by setting the config value to
false
:$ git config --global core.autocrlf false
[^progit2]: git-scm.com
, ProGit 2 book, Customizing Git Configuration
I think it sounds like a potential problem for anyone who self hosts with windows. We should therefore have it as part of our getting started or installation docs under a Windows subsection
it only affects self hosted windows, documentation should do, maybe a FAQ for "bad replacement position of version" or something alike, do we have a FAQ?
i think we can move this issue to a discussion or close it
I think it just should be a prerequisite of running on windows and we don't need to worry people with low level details of failures which won't happen as long as they follow the prerequisites
:tada: This issue has been resolved in version 32.101.0 :tada:
The release is available on:
32.101.0
Your semantic-release bot :package::rocket:
What Renovate type are you using?
Self-hosted Renovate. Using the latest 21.29.1
Describe the bug
Typically I use attributes which are allowed on properties within maven such as.