Example of an invalid casing for a Global Variable in a Pipeline Shared Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started by user rtyler | |
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: | |
WorkflowScript: 2: unexpected token: Mr Jenkins @ line 2, column 14. | |
SayHello "Mr Jenkins" | |
^ | |
1 error | |
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310) | |
at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150) | |
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120) | |
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132) | |
at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:360) | |
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:145) | |
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111) | |
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:237) | |
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:167) | |
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931) | |
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593) | |
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569) | |
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546) | |
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298) | |
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268) | |
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688) | |
at groovy.lang.GroovyShell.parse(GroovyShell.java:700) | |
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67) | |
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:429) | |
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:392) | |
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:221) | |
at hudson.model.ResourceController.execute(ResourceController.java:98) | |
at hudson.model.Executor.run(Executor.java:404) | |
Finished: FAILURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
SayHello "Mr Jenkins" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
def call(name) { | |
echo "Hello the ${name}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The variable name should be
sayHello
or similar, per the docs: https://jenkins.io/doc/book/pipeline/shared-libraries/#defining-custom-steps