I want to use gcloud
in Jenkins pipeline and therefore I have to authenticate first with the Google Service account. I\'m using the https://wiki.jenkins.io/display/
You need to upload your Sevice Account JSON file as a secret file. Then:
withCredentials([file(credentialsId: 'key-sa', variable: 'GC_KEY')]) {
sh("gcloud auth activate-service-account --key-file=${GC_KEY}")
sh("gcloud container clusters get-credentials prod --zone northamerica-northeast1-a --project ${project}")
}