I am trying to create a Jenkins pipeline with active choice parameter options populated with GKE Cluster namespaces.
I can Run a single shell command and get output with this
def namespaces = "kubectl get ns".execute()
def namespace_string = namespaces.text
But or this usecase I need to execute all below three shell commands in one process(authenticate cluster, switch to cluster, get namespaces) but seems they are not running in the same process
"sudo gcloud auth activate-service-account --key-file=key_file.json"
"gcloud container clusters get-credentials $CLUSTER --region $REGION --project $PROJECT"
"kubectl get ns"
Can anyone help with this? Please note that this is for populating active choice list.