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

Allow executing Gradle from GRADLE_HOME and not just via path #2856

Open
enaess opened this issue Jan 31, 2025 · 0 comments
Open

Allow executing Gradle from GRADLE_HOME and not just via path #2856

enaess opened this issue Jan 31, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@enaess
Copy link

enaess commented Jan 31, 2025

Describe the bug

I have a Jenkins pipeline script where I want to execute jf gradle .... The stage is executed by a docker agent. However, with Jenkins' tooling for Gradle (e.g. tools name: "gradle-8.5", type "gradle" will install the tool into /home//tool and add it to the path.

Current behavior

However, because the PATH is not passed onto the docker container doing the build (nor should it), the jf gradle command fails with command not found i.e. gradle is not on the path.

Reproduction steps

pipeline {
    agent {
        docker {
            label "linux"
            image "android-builder:jammy-20250127"
            args "--mount type=bind,src=$home/tools,dst=$home/tools
        }
    }
    stages {
        stage("Build") {
            tools {
                jfrog 'jfrog-cli'
                gradle 'gradle-8.8'
            }
            environment {
                GRADLE_HOME = tool name: 'gradle-8.8', type: gradle
            }
            steps {
                script {
                    jf 'config use myartifactory'
                    jf 'rt ping'
                    jf 'gradle clean artifactoryPublish' // command fails as PATH is incorrect (missing e.g. PATH=$PATH:$GRADLE_HOME)
                }
            }
        }
    }
}

Expected behavior

jfrog-cli should be aware of GRADLE_HOME and execute $GRADLE_HOME/bin/gradle if $GRADLE_HOME is found in the environment, otherwise fallback to using the PATH. Or maybe allow the user a command line option to specify the gradle executable??

Note that the jf plugin seems quite capable of locating the jf executable set in the environment as: JFROG_BINARY_PATH=/home/<user>/tools/io.jenkins.plugins.jfrog.JfrogInstallation/jfrog-cli

JFrog CLI version

2.73.2

Operating system type and version

linux

JFrog Artifactory version

N/A

JFrog Xray version

N/A

@enaess enaess added the bug Something isn't working label Jan 31, 2025
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