-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: golang-plugin
-
None
Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.
The issues I ran into:
- Accessing a tool in a declarative pipeline should work just fine.
- Defining a custom workspace is not allowed in a declarative pipeline.
- Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.
This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.
node {
def goHome = tool('go-1.11')
ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
...
}
}