Multibranch Pipeline: GCC errors does not stand out

147 views
Skip to first unread message

Sverre Moe

unread,
Oct 19, 2016, 3:55:27 AM10/19/16
to Jenkins Users
The Pipeline Stage View, show Logs
It should show red color for those steps that has error, I have seen it on some occasions. However it does not highlight those steps that has gcc compile errors.

Our developers opinion is that the Console output is difficult to parse. since all the paralell runs are all jumbled all together. I have tried the AnsiColorBuildWrapper, but that does not work. Shouldn't the AnsiColorBuildWrapper color the output, but what are the criteria for the coloring?

The Snippet Generator gives me the following not working example
wrap(<object of type hudson.plugins.ansicolor.AnsiColorBuildWrapper>) {
  make
}


BUG! exception in phase 'semantic analysis' in source unit 'WorkflowScript' The lookup for com.company.ci.Build caused a failed compilaton. There should not have been any compilation from this call.
 at org
.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:190)
 at org
.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:170)
 at org
.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:126)
 at org
.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:676)
 at org
.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:308)
 at org
.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:276)
 at org
.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:260)
 at org
.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:272)
 at org
.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1047)
 at org
.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:706)
 at org
.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression(ResolveVisitor.java:1088)
 at org
.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:698)
 at org
.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
 at org
.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
 at org
.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
 at org
.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
 at org
.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1318)
 at org
.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
 at org
.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
 at org
.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
 at org
.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
 at org
.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:201)
 at org
.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
 at org
.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
 at org
.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
 at org
.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1261)
 at org
.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:176)
 at org
.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651)
 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.compile(CompilationUnit.java:542)
 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:411)
 at org
.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:374)
 at org
.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:220)
 at hudson
.model.ResourceController.execute(ResourceController.java:98)
 at hudson
.model.Executor.run(Executor.java:404)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/var/lib/jenkins/workflow-libs/src/com/company/ci/Build.groovy: 461: unexpected token: < @ line 461, column 10.
       wrap
(<object of type hudson.plugins.ansicolor.AnsiColorBuildWrapper>) {
           
^


Another syntax I could find on some examples out there does not Highlight errors:
wrap([$class: 'AnsiColorBuildWrapper']) {
  make
}

Sverre Moe

unread,
Oct 24, 2016, 4:48:33 AM10/24/16
to Jenkins Users
When running make manually on the command line I get highlighting. It would help the developers greatly if they could see the same in Jenkins Console Output.

Baptiste Mathus

unread,
Oct 26, 2016, 9:02:11 AM10/26/16
to jenkins...@googlegroups.com
Hi, you have to understand a bit more how things work to enable that.

On the CLI, this is generally done through ansi escape codes. So, to enable that on Jenkins, you "just" have to enable "something" that would translate those to something a web browser can understand: https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin 

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/235757a5-ec1d-4293-af66-a64018a277db%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Sverre Moe

unread,
Oct 27, 2016, 3:02:22 AM10/27/16
to Jenkins Users, m...@batmat.net
There is not much information on that plugin page how to do that. In Jenkins configuration for ANSI Color there are xterm, vga, css and gnome-terminal. Those are only color codes, and there is nothing how to "translate" the ansi escape codes.

I found a Pipeline example on the plugin github page that worked partially. By setting the parameter colorMapName I was able to get coloring on tests that where running with RUN OK, PASSED. However the compiling (Building CXX Object) did not get colored.
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {

}
The snippet generator does not work for this build wrapper.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Björn Pedersen

unread,
Oct 27, 2016, 4:46:51 AM10/27/16
to Jenkins Users, m...@batmat.net
Hi,

Most probable reason: gcc will only emit color codes if run in an interactive terminal( with a console attached). Check gcc docs how to enable this for non-interactive runs, or check bash manuals how to force interactive mode.

Björn
Reply all
Reply to author
Forward
0 new messages