Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31029

no known implementation of class jenkins.tasks.SimpleBuildWrapper

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ansicolor-plugin
    • None
    • fails on OSX, works on Linux

      A straightforward JUnit test is failing on OSX and succeeds on Linux, presumably this means the implementation will be broken on OSX as well.

      public class AnsiColorBuildWrapperWorkflowTest {
      	@ClassRule
          public static BuildWatcher buildWatcher = new BuildWatcher();
          
          @Rule
          public RestartableJenkinsRule story = new RestartableJenkinsRule();
      
          @Test
          public void testWorkflowWrap() throws Exception {
              story.addStep(new Statement() {
                  @Override
                  public void evaluate() throws Throwable {
                      Assume.assumeTrue(!Functions.isWindows());
                      WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
                      p.setDefinition(new CpsFlowDefinition(
                              "node {\n"
                              + "  wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm', 'defaultFg': 1, 'defaultBg': 2]) {\n"
                              + "    sh(\"\"\"#!/bin/bash\n"
                              + "      echo -e '\\\\e[31mred\\\\e[0m'\"\"\"\n"
                              + "    )\n"
                              + "  }\n"
                              + "}"
                      ));
                      story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
                      StringWriter writer = new StringWriter();
                      p.getLastBuild().getLogText().writeHtmlTo(0L, writer);
                      assertTrue(writer.toString().matches("(?s).*<span style=\"color: #CD0000;\">red</span>.*"));                        
                  }
              });
          }
      
      }
      
      java.lang.UnsupportedOperationException: no known implementation of class jenkins.tasks.SimpleBuildWrapper is named AnsiColorBuildWrapper
          at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:233)
          at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:186)
          at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:91)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:103)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:133)
      

      See https://github.com/dblock/jenkins-ansicolor-plugin/pull/60.

          [JENKINS-31029] no known implementation of class jenkins.tasks.SimpleBuildWrapper

          Daniel Doubrovkine created issue -

          Jesse Glick added a comment -

          If it passes on Linux, there is probably something wrong with the Mac build environment. Without having a Mac, I cannot help you. Most likely the annotation processor for @Extension was not run for some reason (see target/classes/META-INF/annotations/hudson.Extension), perhaps because you neglected to do a clean build.

          Jesse Glick added a comment - If it passes on Linux, there is probably something wrong with the Mac build environment. Without having a Mac, I cannot help you. Most likely the annotation processor for @Extension was not run for some reason (see target/classes/META-INF/annotations/hudson.Extension ), perhaps because you neglected to do a clean build.
          Jesse Glick made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Daniel Doubrovkine added a comment - - edited

          jglick So you don't have a mac and just resolve this as "don't have a mac, therefore cannot reproduce"? Cmon. We have multiple people that have been looking at this and still cannot find the root cause.

          Daniel Doubrovkine added a comment - - edited jglick So you don't have a mac and just resolve this as "don't have a mac, therefore cannot reproduce"? Cmon. We have multiple people that have been looking at this and still cannot find the root cause.

          Also look at https://github.com/dblock/jenkins-ansicolor-plugin/pull/60, the same code works on a Linux CI and fails on OSX CI. I am going to call this a Jenkins bug.

          Daniel Doubrovkine added a comment - Also look at https://github.com/dblock/jenkins-ansicolor-plugin/pull/60 , the same code works on a Linux CI and fails on OSX CI. I am going to call this a Jenkins bug.

          Jesse Glick added a comment -

          Well you need to look harder: check the file I mentioned (the most likely problem), else open a debugger. It is possible this is a genuine bug in Jenkins core or Workflow plugin or ANSI Color plugin which for some reason manifests itself only on OS X, but my educated guess is that it is an environmental issue.

          Jesse Glick added a comment - Well you need to look harder: check the file I mentioned (the most likely problem), else open a debugger. It is possible this is a genuine bug in Jenkins core or Workflow plugin or ANSI Color plugin which for some reason manifests itself only on OS X, but my educated guess is that it is an environmental issue.

          Daniel Doubrovkine added a comment - - edited

          This isn't helpful. I've spent a lot of time in the debugger, and trying to understand what is going on with these extensions and plugins, what's loaded and what's not loaded and I cannot make heads or tails out of it.

          We have a branch called `osx`, https://github.com/dblock/jenkins-ansicolor-plugin/tree/osx, `mvn test` succeeds on Linux and fails on OSX. There's no difference in environment between the two. You can compare on Travis-CI here: https://travis-ci.org/dblock/dblock/jenkins-ansicolor-plugin/builds/86233935.

          If someone is reading this and is a Jenkins expert who actually cares, and is willing to check out the source on OSX and help us with a fix, that'd be ... helpful.

          Daniel Doubrovkine added a comment - - edited This isn't helpful. I've spent a lot of time in the debugger, and trying to understand what is going on with these extensions and plugins, what's loaded and what's not loaded and I cannot make heads or tails out of it. We have a branch called `osx`, https://github.com/dblock/jenkins-ansicolor-plugin/tree/osx , `mvn test` succeeds on Linux and fails on OSX. There's no difference in environment between the two. You can compare on Travis-CI here: https://travis-ci.org/dblock/dblock/jenkins-ansicolor-plugin/builds/86233935 . If someone is reading this and is a Jenkins expert who actually cares, and is willing to check out the source on OSX and help us with a fix, that'd be ... helpful.
          Daniel Doubrovkine made changes -
          Component/s New: ansicolor-plugin [ 15995 ]

          I am going to reopen this because it's an issue. I am also going to label it ansicolor-plugin since we don't know where the problem is. If jglick feels like closing it again I won't object.

          Daniel Doubrovkine added a comment - I am going to reopen this because it's an issue. I am also going to label it ansicolor-plugin since we don't know where the problem is. If jglick feels like closing it again I won't object.
          Daniel Doubrovkine made changes -
          Assignee Original: Jesse Glick [ jglick ] New: Daniel Doubrovkine [ dblock ]
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

            dblock Daniel Doubrovkine
            dblock Daniel Doubrovkine
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: