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

config file is lock under a tmp folder #36

Open
jfsarang opened this issue Aug 26, 2024 · 1 comment
Open

config file is lock under a tmp folder #36

jfsarang opened this issue Aug 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jfsarang
Copy link

Describe the bug

During JFrog installation, even if you set the JFROG_CLI_HOME env variable to set the home dir, the CLI creates the home dir under a tmp/ folder, which causes an issue where user cannot add the Artifactory public cert to JFrog CLI later via $JFROG_CLI_HOME/.jfrog/security/certs

Current behavior

During JFrog installation, CLI creates the JFROG_CLI_HOME under a temp dir, as seen in the debug output around creation of the config file lock under a tmp/ folder:

[gradle-example-ci-server] $ /var/jenkins_home/tools/io.jenkins.plugins.jfrog.JfrogInstallation/jfrog-cli/jf c add arty [email protected] ******** --url=https://arty.jfrog.io/ --artifactory-url=https://arty.jfrog.io/artifactory --distribution-url=https://arty.jfrog.io/distribution --xray-url=https://arty.jfrog.io/xray --interactive=false --overwrite=true 16:38:23 [Debug] JFrog CLI version: 2.62.0 . . . 16:38:23 [Debug] Locking config file to run config AddOrEdit command. 16:38:23 [Debug] Creating lock in: /var/jenkins_home/workspace/test/gradle-examples/gradle-example-ci-server**@tmp/jfrog/37/.jfrog/locks/config** 16:38:23 [Debug] config file is released.

Because of this, when user passed the public cert via JFROG_CLI_HOME/.jfrog/security/certs, it wasn't added to JFrog CLI and caused this error:
19:58:38 [Error] The following error was received while trying to encrypt your password: Get "https://<URL>/artifactory/api/security/encryptedPassword": tls: failed to verify certificate: x509: certificate signed by unknown authority

Reproduction steps

Install JFrog Plugin to Jenkins, configure Artifactory connection, run example Jenkins pipeline script:
`pipeline {
agent any

environment {
    JFROG_CLI_LOG_LEVEL = "DEBUG"
    JFROG_CLI_RELEASES_REPO = "artifactory/jfrog-cli-remote"
    JFROG_CLI_BUILD_NAME = "test-gradle"
    JFROG_CLI_BUILD_NUMBER = "1.0.0"
    JFROG_CLI_HOME = "/var/jenkins_home/workspace/test/gradle-examples/gradle-example-ci-server"
}

 tools {
    jfrog 'jfrog-cli'
}

stages {
    stage('Clone') {
        steps {
            git branch: 'master', url: "https://github.com/jfrog/project-examples.git"
            sh 'echo $JFROG_CLI_HOME'
        }
    }

    stage('Exec Gradle commands') {
        steps {
            dir('gradle-examples/gradle-example-ci-server') {
                jf '--version'
                
                // Configure Gradle project's repositories
                jf 'gradle-config --repo-resolve test-gradle-dev --repo-deploy test-gradle-release--uses-plugin'
                
                // Install and publish project
                jf 'gradle clean artifactoryPublish -b */build.gradle --build-name=$JFROG_CLI_BUILD_NAME --build-number=$JFROG_CLI_BUILD_NUMBER'
            }
        }
    }

    stage('Publish build info') {
        steps {
            jf 'rt build-publish $JFROG_CLI_BUILD_NAME $JFROG_CLI_BUILD_NUMBER'
        }
    }
}

}`

Expected behavior

There should be a way to set the JFROG_CLI_HOME variable when running jf commands in jenkins.

JFrog plugin version

1.5

JFrog CLI version

2.60.0

Operating system type and version

macOS - 14.4.1 - 23E224

JFrog Artifactory version

No response

JFrog Xray version

No response

@jfsarang jfsarang added the bug Something isn't working label Aug 26, 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

5 participants
@jfsarang and others