org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 4: Tool type “go” does not have an install of “go-1.4” configured - did you mean “null”? @ line 4, column 12.
go ‘go-1.4’
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:677)
at groovy.lang.GroovyShell.parse(GroovyShell.java:689)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:513)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE
My code
pipeline {
agent any
tools {
go ‘go-1.4’
}
environment {
GO111MODULE='on'
}
stages {
stage('Test') {
steps {
git 'https://github.com/AdminTurnedDevOps/go-webapp-sample.git'
sh 'go test ./...'
}
}
}
Hello rahul.rbl,
you should install go on your Jenkins server and make sure that you can run the go commands under user Jenkins to use it in your pipeline.
From what I can see, the pipeline is requesting tool go-1.4
From the screen dump, the go version installed is go-1.18.3
The tool needs to match the version. This is so Jenkins can be aware of multiple versions of a tool installed on the server, and select the correct one appropriate for the build.
I had the same issue. I followed the steps in this link
Do this:
Dashboard > Manage Jenkins > Global Tool Configuration
Then scroll down to GO
add GO
in the Name do the same you wrote in the Jenkinsfile in this case go-1.14
I thicked the “Install automatically” and “Install from goland.org” I choose the Go 1.14
Save
Started by user jenkins-learning
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 4: Tool type "go" does not have an install of "go-1.14" configured - did you mean "GO"? @ line 4, column 12.
go 'go-1.14'
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:563)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:515)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:336)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE
pipeline {
agent any
tools {
go 'go-1.14'
}
environment {
GO111MODULE='on'
}
stages {
stage('Test') {
steps {
git 'https://github.com/kodekloudhub/go-webapp-sample.git'
sh 'go test ./...'
}
}
}
}
[root@ip-172-31-22-16 ~]# go version
-bash: /usr/bin/go: No such file or directory
[root@ip-172-31-22-16 ~]#