jenkinsci / jenkinsci/jfrog-plugin
rt build-publish not handling special characters in job names
- Dominant language
- Java
- Stars
- 16
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
Build info records for Jenkins jobs with special characters in the name are broken. Accessing the build info through the “Artifactory Build Info” link inside Jenkins and the Artifactory UI does not work as intended. It appears to be related to disagreements in URL encoding between the Jenkins plugin, the generated build-info file, and Artifactory.
### Current behavior
I created a minimum job that published the following job-info file for testing:
```json
{
"version" : "1.0.1",
"name" : "foo/bar",
"number" : "3",
"buildAgent" : {
"name" : "GENERIC",
"version" : "2.53.2"
},
"agent" : {
"name" : "jenkins-jfrog-plugin",
"version" : "1.5.0"
},
"started" : "2024-03-08T17:54:38.413+0000",
"durationMillis" : 0,
"artifactoryPrincipal" : "bot@example.com",
"url" : "https://jenkins.example.com/job/foo/job/bar/3/"
}
```
The record itself appears as `artifactory-build-info/foo%2Fbar/3-1709920478413.json` in Artifactory.
When using the info link generated by Jenkins, for example, https://artifactory.example.com/ui/builds/foo%2Fbar/3/1709920478413/published?buildRepo=artifactory-build-info, I am redirected to the Artifactory home page. My web console shows I got a 404 for the requested page before the redirect.
When I attempt to navigate to the build in the Artifactory UI (https://artifactory.example.com/ui/builds/foo%2Fbar/?buildRepo=artifactory-build-info) the page hangs and never loads.

Using the web console, I can see that it is getting a 404 trying to POST to the API (https://artifactory.example.com/ui/api/v1/global-search/builds/foo%2Fbar?jfLoader=false).
Digging into it a bit, if I manually upload a build-info file replacing the name `foo/bar` with `foo%2Fbar` it generates a `artifactory-build-info/foo%252Fbar/3-1709920478413.json` record that does work as intended in the Artifactory UI, with the caveat that it appears as `foo%2Fbar` instead of `foo/bar` in the build-info menu.
This appears to be related to some URL encoding disagreements between the plugin and Artifactory. I am not sure which is at fault exactly, but I would love to see a workaround or fix for this issue, as not having access to build info is also breaking things like artifact promotion.
### Reproduction steps
1. create a Jenkins pipeline within a folder, or a multi-branch job ex. `foo/bar`
2. use the plugin to publish build info `jf "rt build-publish"`
3. Try and view the build info in the Artifactory UI, or use the Build Info link in Jenkins
### Expected behavior
You should be able to access the build info via the Jenkins link and view it in the Artifactory UI.
### JFrog plugin version
1.5.0
### JFrog CLI version
2.53.2
### Operating system type and version
linux, ubuntu, 22.04
### JFrog Artifactory version
7.77.6
### JFrog Xray version
n/a
Contributor guide
Research direction
Start at the rt build-publish entry point and trace how the plugin writes the build-info name and constructs the Jenkins and Artifactory links. Reproduce with a folder job named foo/bar, then verify that the generated record can be opened from both links and in the Artifactory UI without changing the displayed name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100