Open joshOfAllTrades opened 2 months ago
Interesting issue.
There is one other issue I have been contemplating working on, maybe while I am in the code I look at this as well. I can’t give you a timeframe, since I am a single developer with lots of other things on my plate, but I will look into this.
Renaming the job to not use the same slash used in http urls would be a good work around, but I understand that that may not be an option.
Thanks for reporting the issue.
On Jul 17, 2024, at 7:06 AM, Joshua Tharp @.***> wrote:
I have a multi-branch build job configured on my Jenkins server. When the branch name contains a slash '/' (which happens when you want to group your branches/PRs based on a Jira ticket or are using certain Git organizations) then CiPol builds an incorrect URL which in turn fails to get the proper status from Jenkins.
For example, if I have the branch name feature/TICKET-1234 and I select the branch build in CiPol, then the URL constructed in CiPol looks like {my_jenkins_host}/job/multibranch_pipeline/job/feature0.000000TICKET-1234.
Obviously, Jenkins has no idea what that URL means, so CiPol status is always gray/unknown and clicking through doesn't work.
— Reply to this email directly, view it on GitHub https://github.com/rondorn/CiPol/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADD34KITBNGKEOQKJY7GOT3ZMZ265AVCNFSM6AAAAABLAW5XYGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYTGNZSGAZDSMI. You are receiving this because you are subscribed to this thread.
Interestingly, when you look at the drop-down to add the project, the name of the branch build is feature%2FTICKET-1234
, so it's URL encoded at that point.
Yea, it is for sure a bug and is fixable (I would assume).
I will look into this for sure.
On Jul 17, 2024, at 7:47 AM, Joshua Tharp @.***> wrote:
Interestingly, when you look at the drop-down to add the project, the name of the branch build is feature%2FTICKET-1234, so it's URL encoded at that point.
— Reply to this email directly, view it on GitHub https://github.com/rondorn/CiPol/issues/6#issuecomment-2233508386, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADD34KLV32JEOWY2OGSOYLLZMZ7X7AVCNFSM6AAAAABLAW5XYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZTGUYDQMZYGY. You are receiving this because you commented.
I'm not familiar with Swift, but I'm looking through the code to see if I can spot the issue.
The URL in my browser when I navigate to the job is
{my_jenkins_host}/job/multibranch_pipeline/job/feature%252FTICKET-1234/
while as I said before, the one CiPol produces is
{my_jenkins_host}/job/multibranch_pipeline/job/feature0.000000TICKET-1234
I think I found it. In Utilities.swift
you have this function.
static func cleanUpURL(url: String)->String {
var cleanUrl = String(format: url)
cleanUrl = cleanUrl.replacingOccurrences(of: " ", with: "%20")
return cleanUrl
}
If I'm not mistaken this line var cleanUrl = String(format: url)
is interpreting the passed in URL as a printf style format string in which case the URL encoded slash %2F
is considered the formatting command for printing a float (only there isn't a parameter so it's formatting null or zero), which is why the resulting URL has the 0.000000
in it.
I can't build/test the Swift, but I think changing that line to
var cleanUrl = url.addingPercentEncoding(withAllowedCharacters: allowedCharacters)
fixes the issue.
Ok great. I will forces on this code when I am ready to make this change.ThanksSent from my iPadOn Jul 17, 2024, at 8:51 AM, Joshua Tharp @.***> wrote: I think I found it. In Utilities.swift you have this function. static func cleanUpURL(url: String)->String {
var cleanUrl = String(format: url)
cleanUrl = cleanUrl.replacingOccurrences(of: " ", with: "%20")
return cleanUrl
}
If I'm not mistaken this line var cleanUrl = String(format: url) is interpreting the passed in URL as a printf style format string in which case the URL encoded slash %2F is considered the formatting command for printing a float (only there isn't a parameter so it's formatting null or zero).
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
I have a multi-branch build job configured on my Jenkins server. When the branch name contains a slash '/' (which happens when you want to group your branches/PRs based on a Jira ticket or are using certain Git organizations) then CiPol builds an incorrect URL which in turn fails to get the proper status from Jenkins.
For example, if I have the branch name
feature/TICKET-1234
and I select the branch build in CiPol, then the URL constructed in CiPol looks like{my_jenkins_host}/job/multibranch_pipeline/job/feature0.000000TICKET-1234
.Obviously, Jenkins has no idea what that URL means, so CiPol status is always gray/unknown and clicking through doesn't work.