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

jf rt build-append fails with 404 when looking for a build with ":" in name #1803

Open
lmcpare opened this issue Jan 11, 2023 · 8 comments · Fixed by jfrog/jfrog-cli-core#1020
Labels
bug Something isn't working

Comments

@lmcpare
Copy link

lmcpare commented Jan 11, 2023

Describe the bug

The build-append command fails to process builds that include the ":" character in their name.

The same command succeeds when processing standard build names, i.e. with the ":" character in them.

Current behavior

$ JFROG_CLI_LOG_LEVEL=DEBUG jf rt build-append "pare-test" "0.0.2" "ksdf::full-buildinfo" "2"
18:01:01 [Debug] JFrog CLI version: 2.32.0
18:01:01 [Debug] OS/Arch: linux/amd64
18:01:01 [🔵Info] Running Build Append command...
18:01:01 [Debug] Saving build general details at: /tmp/jfrog/builds/ba4f5e3ece384f1d5aecfefeb3cb68fbda4fccd635442aec4113c5a6dbc9f3b9/partials
18:01:01 [Debug] Usage Report: Sending info...
18:01:01 [Debug] Getting build-info from:  https://jfrog.kaloom.io/artifactory/api/build/ksdf::full-buildinfo/2
18:01:01 [Debug] Sending HTTP GET request to: https://jfrog.kaloom.io/artifactory/api/build/ksdf::full-buildinfo/2
18:01:01 [Debug] Sending HTTP GET request to: https://jfrog.kaloom.io/artifactory/api/system/version
18:01:01 [Debug] Artifactory response: 200 
18:01:01 [Debug] JFrog Artifactory version is: 7.47.12
18:01:01 [Debug] Sending HTTP POST request to: https://jfrog.kaloom.io/artifactory/api/system/usage
18:01:01 [Debug] Build ksdf::full-buildinfo/2. Started: 2023-01-11T16:30:43.541-0500. Calculated timestamp: 1673472643541
18:01:01 [Debug] Sending HTTP HEAD request to: https://jfrog.kaloom.io/artifactory/artifactory-build-info/ksdf::full-buildinfo/2-1673472643541.json
18:01:01 [Debug] Usage Report: Artifactory response: 200 
18:01:01 [Debug] Usage Report: Usage info sent successfully.
18:01:01 [🚨Error] server response: 404

These are the associated logs in artifactory-request.log:

2023-01-11T23:01:01.455Z|75bf6d7451c06a03|10.128.0.2|pare|GET|/api/system/version|200|-1|0|1|jfrog-cli-go/2.32.0
2023-01-11T23:01:01.458Z|36bf355973f40150|10.128.0.2|pare|GET|/api/build/ksdf::full-buildinfo/2|200|-1|0|3|jfrog-cli-go/2.32.0
2023-01-11T23:01:01.464Z|420bf3aa9e3e8d48|10.128.0.2|pare|POST|/api/system/usage|200|80|0|0|jfrog-cli-go/2.32.0
2023-01-11T23:01:01.474Z|c022b6be5fb9d90d|10.128.0.2|pare|HEAD|/artifactory-build-info/ksdf::full-buildinfo/2-1673472643541.json|404|-1|0|1|jfrog-cli-go/2.32.0

Reproduction steps

Using the build-append command, append the buildInfo of an existing build whose name include a ":" character in it.

Repeat the same command with a regular build name succeeds.

Expected behavior

The build-append command should behave properly for any build name, with or without special chars.

Suggestion: the cli code might need to encode the paths it sends to Artifactory. In the case of build names with special chars, their location within the artifactory-build-info is encoded, where : is replaced by %3A internally in the repo. It may be the reason why the build-append command as it is currently fails.

JFrog CLI version

2.32.0

Operating system type and version

Fedora 36

JFrog Artifactory version

7.47.12

JFrog Xray version

No response

@lmcpare lmcpare added the bug Something isn't working label Jan 11, 2023
@lmcpare lmcpare changed the title jf rt build-append fails with 404 when looking for a build with ":" in name jf rt build-append fails with 404 when looking for a build with ":" in name Jan 12, 2023
@john-heinnickel
Copy link

john-heinnickel commented Apr 17, 2023

+1 on this issue

We have the same thing resulting from using default build names on a Jenkins system where the build definitions are kept under folders. Each path separator in the folder hierarchy becomes ' :: ' (a pair of colons with a space on either side) in the build name, and rt ba is the only JFrog CLI command we're using that cannot seem to handle these names.

Same result, a 404 error with no descriptive message

Curiously enough, some of the variations I've tried to look for a workaround print an informative message about the target not being found instead of the more cryptic server response: 404 message. I'll add some sample outputs in case this happens to provide any hints about where the encoding is breaking down

Examples:

// Baseline example, spaces and colons as spaces and colons
$ jf rt ba "csd-genexus- :: dl-installer :: release-0.99.4" "4" "csd-genexus- :: dl-auth-gateway :: release :: 0.99.4" "1"
21:11:50 [🔵Info] Running Build Append command...
21:11:50 [🚨Error] server response: 404 
// Left just the spaces URL-encoded
$ jf rt ba "csd-genexus- :: dl-installer :: release-0.99.4" "4" "csd-genexus-%20::%20dl-auth-gateway%20::%20release%20::%200.99.4" "1"
21:12:14 [🔵Info] Running Build Append command...
21:12:14 [🚨Error] Build csd-genexus-%20::%20dl-auth-gateway%20::%20release%20::%200.99.4/1 not found in Artifactory.
// Sent genuine quotation marks around the name string, appended argument only
root@lemon:~/Git/csd-dl-deployment/builds (git:initial)$ jf rt ba "csd-genexus- :: dl-installer :: release-0.99.4" "4" '"csd-genexus- :: dl-auth-gateway :: release :: 0.99.4"' "1"
21:12:28 [🔵Info] Running Build Append command...
21:12:29 [🚨Error] Build "csd-genexus- :: dl-auth-gateway :: release :: 0.99.4"/1 not found in Artifactory.
// Attempted backslash escaping of spaces
$ jf rt ba "csd-genexus- :: dl-installer :: release-0.99.4" "4" 'csd-genexus-\ ::\ dl-auth-gateway\ ::\ release\ ::\ 0.99.4' "1"
21:12:57 [🔵Info] Running Build Append command...
21:12:57 [🚨Error] server response: 400 
<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1></body></html>
// Attempted the conventional replacement of spaces with '+'
$ jf rt ba "csd-genexus- :: dl-installer :: release-0.99.4" "4" "csd-genexus-+::+dl-auth-gateway+::+release+::+0.99.4" "1"
21:13:23 [🔵Info] Running Build Append command...
21:13:24 [🚨Error] Build csd-genexus-+::+dl-auth-gateway+::+release+::+0.99.4/1 not found in Artifactory.

@DavidRadoorHummel
Copy link

We have the same issue, though the error is a bit different:

jf rt ba MultiPromoteTest 1 "FB :: ProgDevice2 QA" 897 --server-id=test
11:51:05 [Info] Running Build Append command...
11:51:10 [Error] parsing time "2023-01-08T21:42:40.754+01:00" as "2006-01-02T15:04:05.000-0700": cannot parse "+01:00" as "-0700"

Result is the same though, the append command fails to append the build.

@yahavi
Copy link
Member

yahavi commented Sep 21, 2023

@lmcpare @john-heinnickel
Thanks for reporting this issue.
We're currently targeting to handle this issue during Q4.
We'll keep you posted.

@DavidRadoorHummel
Could you please create another issue with much details as possible such as steps to reproduce and your Artifactory version?


Duplication of #2043

@yahavi
Copy link
Member

yahavi commented Nov 8, 2023

@lmcpare @DavidRadoorHummel
We created jfrog/jfrog-cli-core#1020 to fix this issue.
We'll keep you posted.

@DavidRadoorHummel
Copy link

Thanks, but we're completely reworking how build info is used in Artifactory. We have use cases where we need build info to have different package protocols in one and be able to promote this. This doesn't work, by default, in Artifactory.

@yahavi
Copy link
Member

yahavi commented Nov 8, 2023

Sure @DavidRadoorHummel
Feel free to contact us if there's anything we can assist with.

@DavidRadoorHummel
Copy link

You're already helping immensely by maintaining JFrog CLI 😄 Great tool!

@yahavi
Copy link
Member

yahavi commented Nov 19, 2023

@lmcpare
JFrog CLI 2.51.1 has been released.
This version includes the fix for this issue.
Feel free to upgrade - we'd appreciate your feedback on that!

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

Successfully merging a pull request may close this issue.

4 participants