1

I am using below pipeline script in jenkins to run the build and the slave is windows machine. when i run the build with out script it works fine when i use pipelinescript to run jenkins build it throws below error 'gradle' is not recognized as an internal or external command, operable program or batch file. I have added GRADlE_HOME in global configuration but still the issues exists

node('windows_slave') {
    stage('API') {
       git checkout([$class: 'GitSCM', branch: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'xxxxxxxxx', url: 'ssh://xxxxx@xxxxxxxxx/opt/git/qa/xxx.git']]])
        try {
            // gradle clean QATest
            bat returnStatus: true, script: 'gradle clean QATest --info --continue'
            // sh 'gradle clean QATest'
            // bat "\"${GRADLE_HOME}\"\\bin\\gradle QATest"
            // if (isUnix()) {
    //      sh "'${GRADLE_HOME}/bin' -Dgradle clean QATesty"
    //   } else {
    //      bat(/"${GRADLE_HOME}\bin" -Dgradle clean QATest/)
    //   }
     } catch (err) {

        } 
   }
}
Cena
  • 55
  • 3
  • 8

1 Answers1

1

I have got the fix giving absolute path in pipeline script ha worked, ie Gradle_Home/bin gradle clean

Cena
  • 55
  • 3
  • 8