Jenkins Infinite Loop w/ Powershell evoked from Groovy

346 views
Skip to first unread message

Joe Cavanaugh

unread,
Dec 29, 2017, 10:21:15 AM12/29/17
to Jenkins Users
Set up :

1) Create a Pipeline script in a groovy file such as in the blog post https://jenkins.io/blog/2017/10/02/pipeline-templates-with-shared-libraries/ . I called mine dotNetApiPipeline.groovy and saved it to /vars.
def call(body) {
     // evaluate the body block, and collect configuration into the object
     def pipelineParams = [:]
     body.resolveStrategy = Closure.DELEGATE_FIRST
     body.delegate = pipelineParams
     body() 

     pipeline {
         agent {
             node {
                 label 'master'
             }
         } 
         stages {
             stage('Powershell Test') {
                 steps {
                     powershell 'Write-Output "Hello World"'
                     powershell 'Write-Output "$env:COMPONENTVERSION"' 
                 }
             }
         }
 
      }
}


2) Invoke the script via your pipeline job. 
@Library("Jenkins_Library@powershellTest") _
dotNetApiPipeline {
    COMPONENTVERSION = "0.0.0"
}
 
Weirdly enough it just stuck in an infinite loop on the first powershell call. I noticed in the example they are using only shell scripts and I am making a test for bat files as well. I'm wondering if anyone else is seeing this issue with attempting to make pipeline libraries. 

Thanks,
Joe
 
 

Joe Cavanaugh

unread,
Dec 29, 2017, 10:31:00 AM12/29/17
to Jenkins Users

Forgot to mention - the version of Jenkins is 2.98 with all the latest and greatest plugin versions (I just updated yesterday 12/28/2017). It is a windows master build machine running powershell 3.0 and I haven't tested on a powershell 5.1 machine yet. 

Joe Cavanaugh

unread,
Dec 29, 2017, 11:37:50 AM12/29/17
to Jenkins Users
I can now confirm the standard bat 'echo Hello World' works fine - it is just the powershell keyword that is an issue. 

Joe Cavanaugh

unread,
Jan 10, 2018, 10:42:21 AM1/10/18
to Jenkins Users
Anyone else encountering this issue? 
Reply all
Reply to author
Forward
0 new messages