I use Jenkins installed on GKE. I installed GCloud SDK Plugin and configured it with Global Tool Configuration. When I use gcloud in my pipeline I receive "not found" error. I tried the solution recommended in Executing gcloud command in Jenkins pipeline.
pipeline {
agent any
stages {
stage('Run gcloud') {
steps {
withEnv(['GCLOUD_PATH=/var/jenkins_home/google-cloud-sdk/bin']) {
sh '$GCLOUD_PATH/gcloud --version'
}
}
}
}
}
But there is no "jenkins_home" in my /var directory.
+ ls -l /var/
total 36
drwxr-xr-x 2 root root 4096 Jun 26 2018 backups
drwxr-xr-x 1 root root 4096 Oct 29 2018 cache
drwxr-xr-x 1 root root 4096 Oct 16 2018 lib
drwxrwsr-x 2 root staff 4096 Jun 26 2018 local
lrwxrwxrwx 1 root root 9 Oct 11 2018 lock -> /run/lock
drwxr-xr-x 1 root root 4096 Oct 29 2018 log
drwxrwsr-x 2 root mail 4096 Oct 11 2018 mail
drwxr-xr-x 2 root root 4096 Oct 11 2018 opt
lrwxrwxrwx 1 root root 4 Oct 11 2018 run -> /run
drwxr-xr-x 2 root root 4096 Oct 11 2018 spool
drwxrwxrwt 2 root root 4096 Jun 26 2018 tmp