Capture Helm Package name once it is formed

9/25/2018

I am trying to do a helm package deployment using Jenkins pipeline. I am able to package the charts and deploy it. But in order to make it a dynamic deployment, I want to get the package name once formed & pass it down for further processing.

I have tried below options for groovy, but the variable "packageNm" is not getting any value.

def packageNm = sh(script: "cd ${appName}; printf '%s\n' ${appName}*.tgz", returnStatus: true)
def packageNm = sh(script: "helm package hello-helm -d hello-helm", returnStatus: true)

Any way to get this file name? I even tried to search the file in workspace but the variable name is still empty

-- swetad90
groovy
jenkins-pipeline
kubernetes-helm

1 Answer

9/26/2018

You should use returnStdout instead of returnStatus for getting the standard output into the variable.

-- yorammi
Source: StackOverflow