Re: Unable to pass values into multiple lines sh section

2017-06-26 Thread Qiang
have you tried  """ ?

On Sunday, June 25, 2017 at 4:25:14 AM UTC-5, Idan Adar wrote:
>
> I'm having difficulty passing parameters into a multiple lines sh section 
> like below.
> Can someone help with spotting the problem?
>
> Specifically, 
> 1. $datacenter is empty
> 2. $clusterName is empty
> 3. I suspect $repoName is empty too
>
>
> stage ("Update Deployments") {  
>  steps {
> script {
>def repoList = microServicesToPublish.tokenize(",")
>def clusterList = clustersToPublishTo.tokenize(",")
>
>for (String clusterName : clusterList) {
>   for (String repoName : repoList) {
>  
>  // Create a folder based on the current repository 
> in the list
>  dir(repoName) {
> // Clone it
> git branch: 'master', credentialsId: '', url: 
> "https:////"; + repoName
> 
> // Apply Kubernetes configuration and update the 
> Deployment
> sh '''
>datacenter=${repoName:16}
>export 
> KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml
> 
># Set the build number
>case $repoName in
>   "") 
>  ../../../yaml w -i 
> config/environments//$clusterName/kubernetes/deployment.yaml 
> spec.template.spec.containers[0].image myregistry/mynamespace/myimage:m 
> ytag
>  ;;
>esac
>  '''
>   }
>   }
>}
> }
>}  
>  }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4188272c-7bb3-4b18-b716-42c2b4d67714%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to pass values into multiple lines sh section

2017-06-25 Thread Idan Adar
There are actually two additional def's.

def repoName = ""
def clusterName = ""

On Sunday, June 25, 2017 at 12:25:14 PM UTC+3, Idan Adar wrote:
>
> I'm having difficulty passing parameters into a multiple lines sh section 
> like below.
> Can someone help with spotting the problem?
>
> Specifically, 
> 1. $datacenter is empty
> 2. $clusterName is empty
> 3. I suspect $repoName is empty too
>
>
> stage ("Update Deployments") {  
>  steps {
> script {
>def repoList = microServicesToPublish.tokenize(",")
>def clusterList = clustersToPublishTo.tokenize(",")
>
>for (String clusterName : clusterList) {
>   for (String repoName : repoList) {
>  
>  // Create a folder based on the current repository 
> in the list
>  dir(repoName) {
> // Clone it
> git branch: 'master', credentialsId: '', url: 
> "https:////"; + repoName
> 
> // Apply Kubernetes configuration and update the 
> Deployment
> sh '''
>datacenter=${repoName:16}
>export 
> KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml
> 
># Set the build number
>case $repoName in
>   "") 
>  ../../../yaml w -i 
> config/environments//$clusterName/kubernetes/deployment.yaml 
> spec.template.spec.containers[0].image myregistry/mynamespace/myimage:m 
> ytag
>  ;;
>esac
>  '''
>   }
>   }
>}
> }
>}  
>  }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7c8867ca-6481-4129-b1f3-90bcc78b7311%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unable to pass values into multiple lines sh section

2017-06-25 Thread Idan Adar
I'm having difficulty passing parameters into a multiple lines sh section 
like below.
Can someone help with spotting the problem?

Specifically, 
1. $datacenter is empty
2. $clusterName is empty
3. I suspect $repoName is empty too


stage ("Update Deployments") {  
 steps {
script {
   def repoList = microServicesToPublish.tokenize(",")
   def clusterList = clustersToPublishTo.tokenize(",")
   
   for (String clusterName : clusterList) {
  for (String repoName : repoList) {
 
 // Create a folder based on the current repository in 
the list
 dir(repoName) {
// Clone it
git branch: 'master', credentialsId: '', url: 
"https:////"; + repoName

// Apply Kubernetes configuration and update the 
Deployment
sh '''
   datacenter=${repoName:16}
   export 
KUBECONFIG=/home/bluemix/.bluemix/plugins/container-service/clusters/$clusterName/kube-config-$datacenter-$clusterName.yml

   # Set the build number
   case $repoName in
  "") 
 ../../../yaml w -i 
config/environments//$clusterName/kubernetes/deployment.yaml 
spec.template.spec.containers[0].image myregistry/mynamespace/myimage:m 
ytag
 ;;
   esac
 '''
  }
  }
   }
}
   }  
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/53d89cf2-54db-4b6c-9871-c3c6c64f5a36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.