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-discard isn't sensitive to the the JFROG_CLI_BUILD_PROJECT environment variable #2038

Open
enaess opened this issue Jun 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@enaess
Copy link

enaess commented Jun 23, 2023

Describe the bug

In an Jenkins pipeline, I specify my environment variables such as:

  • JFROG_CLI_BUILD_NAME="build-name"
  • JFROG_CLI_BUILD_PROJECT="my-project"

Then I run the jf rt bdi --max-builds 30 --delete-artifacts at the end of my pipeline.

Current behavior

When I run the jf rt bdi command, it doesn't appear that it actually discarded any builds.

Reproduction steps

12:56:08 [Debug] JFrog CLI version: 2.40.0
12:56:08 [Debug] OS/Arch: linux/amd64
12:56:08 [Debug] Usage Report: Sending info...
12:56:09 [🔵Info] Discarding builds...
12:56:09 [Debug] Sending HTTP POST request to: https://artifactory/artifactory/api/build/retention/MyProject?async=false
12:56:09 [Debug] Sending HTTP GET request to: https://artifactory/artifactory/api/system/version
12:56:09 [Debug] Artifactory response: 200 
12:56:09 [Debug] JFrog Artifactory version is: 7.41.14
12:56:09 [Debug] Sending HTTP POST request to: https://artifactory/artifactory/api/system/usage
12:56:09 [🔵Info] Builds discarded.
12:56:09 [Debug] Usage Report: Usage info sent successfully. Artifactory response: 200 

Next is the working case where I specify the --project parameter on the command line:

12:57:47 [Debug] JFrog CLI version: 2.40.0
12:57:47 [Debug] OS/Arch: linux/amd64
12:57:47 [Debug] Usage Report: Sending info...
12:57:47 [🔵Info] Discarding builds...
12:57:47 [Debug] Sending HTTP POST request to: https://artifactory/artifactory/api/build/retention/MyProject?async=false&project=my-project
12:57:47 [Debug] Sending HTTP GET request to: https://artifactory/artifactory/api/system/version
12:57:47 [Debug] Artifactory response: 200 
12:57:47 [Debug] JFrog Artifactory version is: 7.41.14
12:57:47 [Debug] Sending HTTP POST request to: https://artifactory/artifactory/api/system/usage
12:57:47 [Debug] Usage Report: Usage info sent successfully. Artifactory response: 200 

Notice the presence of the project= parameter to the REST API in my second attempt. It seems to be missing when I specify the JFROG_CLI_BUILD_PROJECT environment variable (and omit the --project parameter).

Expected behavior

I should be able to export the JFROG_CLI_BUILD_PROJECT into the environment and have it be used in place of the --project parameter to the jf command like many other commands

JFrog CLI version

2.40.0

Operating system type and version

Ubuntu 22.04

JFrog Artifactory version

7.41.14

JFrog Xray version

No response

@RobiNino
Copy link
Contributor

Hi @enaess ,
Thank you for reporting this.
JFrog CLI 2.44.0 includes a fix to this issue, feel free to upgrade.
We would appreciate your feedback for it.

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

2 participants