Jenkins active choice options populated with gke cluster namespaces

20 views
Skip to first unread message

samton

unread,
May 6, 2022, 9:58:38 AMMay 6
to Jenkins Users

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()
namespaces.waitFor()
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.

Thanks

Sam

Reply all
Reply to author
Forward
0 new messages