On Friday, February 27, 2015 at 3:10:38 PM UTC-5, Timothy Wojtaszek wrote:
>
> Just collect them and add them to every sh command?
>

Yes, though I would suggest a more readable

def golang = tool name: 'Go 1.2.2', type: 'org.jenkinsci.plugins.golang.
GolangInstallation'
def go(cmd) {
    sh "GOROOT=${golang} ${golang}/bin/go ${cmd}"
}
go 'build …'

There are two basic avenues for improvement. 
First, https://issues.jenkins-ci.org/browse/JENKINS-26128 would allow you 
to write something along the lines of

def golang = tool name: 'Go 1.2.2', type: 'org.jenkinsci.plugins.golang.
GolangInstallation'
withEnv("GOROOT=${golang}", "PATH=${golang}/bin:${env.PATH}") {
  sh 'go build …'
}

which would be just like setting env.WHATEVER except safe for use across 
multiple slaves in one build.

Second, if the API outlined in 
https://issues.jenkins-ci.org/browse/JENKINS-26055 
were implemented, it would be easier for the Go plugin to offer a Workflow 
step that would launch go with a selected GolangInstallation.name and 
arguments, just as a freestyle build step would, including console syntax 
highlighting and whatever. (The existing SimpleBuildStep API in Jenkins 
core, used by the Workflow ‘step’ metastep, cannot support long-running 
external processes that ought to survive Jenkins restarts.)

-- 
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/6fc28709-164e-4d0e-ba00-834d26a5fda4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to