This ended up being a permissions issue. Here's what I did to determine 
that:

def command2 = "git pull"
println ("[$command2]")
StringBuffer sbout = new StringBuffer()
StringBuffer sberr = new StringBuffer()
Process process2 = command2.execute(null, srcDir) 
process2.waitForProcessOutput sbout, sberr
def value = process2.exitValue()
int count = sbout.toString().readLines().size()
println "${sberr.toString()}"
println "Exit value: $value, Err lines: 
${sberr.toString().readLines().size()}, Out lines: $count"
assert count > 1
assert value == 0


Which then output the following:

[git pull]
> Permission denied (publickey).
> fatal: Could not read from remote repository.



On Wednesday, April 1, 2015 at 1:55:23 PM UTC-5, Alex Ward wrote:
>
> Hi,
>
> I am exploring Jenkins as my company's new CI server replacing Cruise 
> Control. I am new to both Jenkins and Groovy. 
>
> I am having an issue running the following Groovy script. The first and 
> last parts run just fine, but for some reason git pull never works. I'm not 
> seeing any exception, just the output "[git pull]".
>
> def srcDir = new File("C://JenkinsBuilds//ProjectName//Source")
>
>
> String command1 = "git checkout master"
> println ("[$command1]")
> Process process1 = command1.execute(null, srcDir)
> process1.waitFor()
> println(process1.text)
>
>
> String command2 = "git pull"
> println ("[$command2]")
> Process process2 = command2.execute(null, srcDir) 
> process2.waitFor()
> println(process2.text)
>
>
> String command3 = "git branch -r --no-merged master"
> println ("[$command3]")
> Process process3 = command3.execute(null, srcDir)
> process3.waitFor()
> println(process3.text)
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6e45ce43-cc53-4fb9-ad98-74a4e4e01003%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to