Skip to content
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

rt build-publish not handling special characters in job names #28

Open
JoshuaHassler opened this issue Mar 8, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@JoshuaHassler
Copy link

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:

{
  "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.
Screenshot from 2024-03-08 14-10-36

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

@JoshuaHassler JoshuaHassler added the bug Something isn't working label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant