-
Notifications
You must be signed in to change notification settings - Fork 85
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
Experimental: Branch Restriction not working with 2 or more branch names #388
Comments
what is written into xml config? |
According to code each line is used for Pattern compilation. You can try to put your rule into single line regexp. |
@KostyaSha thanks for the quick reply.
Where would I find this XML config file? |
Using @KostyaSha, thank you. |
on jenkins master in job's folder |
We think we know what the bug is... The log file shows this:
Using Note++, we verified that the file's line format is Unix (LF). But on Windows, we think that Java is returning \r\n thus.
can't split on \r\n because it only find \n. Thus, LINE_SEPARATOR should be hard-coded to \n or split first on \r\n and then on \n. |
To verify this idea, we converted the file to Windows (CR LF), then restarted the Jenkins service and tested again. But it still failed. 🤔 At least the regex idea works. 😃 |
the correct order may be shutdown, modify, start and verify. On shutdown it may save configs with in-memory data |
It was a good idea, but it didn't work. @KostyaSha - as it appears that this can't be fixed, should we close it out? |
For those who also ran into this issue... To recap the solution, the only viable way to whitelist multiple branches on a Windows machine is to use JAVA'S regex, like so:
|
Configuration:
After a lot of work, we finally got this plugin working. Except when trying to whitelist two or more branches under the
Experimental: Branch Restriction > Whitelist Target Restrictions
section.We have the following top-level protected branches:
DEV
,RELEASE
,PROD
, andHOTFIX
.In my test repo, I have PR from
Features/100-testing
merging intoDEV
.If I set the WhiteList to
DEV
it works. If I set it toABC
, it fails - as expected.BUT, if I try and use a multi-line, like so:
It fails, with this log entry:
Before searching the source code, I also tried using semi-colons (:), commas (,), and spaces ( ), which also failed.
I don't understand why Java's
System.lineSeparator()
doesn't recognize Jenkin's line separator.Source file.
The text was updated successfully, but these errors were encountered: