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 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.

          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.

          Jesse Glick added a comment -

          Can you reproduce locally? If so, you should first inspect the file I mentioned, to see if it in fact contains the indexed extension. If it does, then you will have to step through code starting in DescribableHelper.coerce until you find where it is failing to see the implementation.

          The Travis build is probably the problem, since it is running (essentially) mvn -DskipTests install && mvn test rather than the simpler mvn install, or the faster and safer mvn -DskipTests install && mvn surefire:test or the safer if slower mvn -DskipTests install && mvn clean test. I have no hypothesis why the Linux build would pass if so.

          Jesse Glick added a comment - Can you reproduce locally? If so, you should first inspect the file I mentioned, to see if it in fact contains the indexed extension. If it does, then you will have to step through code starting in DescribableHelper.coerce until you find where it is failing to see the implementation. The Travis build is probably the problem, since it is running (essentially) mvn -DskipTests install && mvn test rather than the simpler mvn install , or the faster and safer mvn -DskipTests install && mvn surefire:test or the safer if slower mvn -DskipTests install && mvn clean test . I have no hypothesis why the Linux build would pass if so.

          Jesse Glick added a comment -

          One thing I thought of is that Mac OS X uses a case-insensitive filesystem by default, so if your filenames do not match names used in code, a Mac test will pass but a Linux test will correctly fail. However that is the reverse of your problem so it is probably a red herring.

          Jesse Glick added a comment - One thing I thought of is that Mac OS X uses a case-insensitive filesystem by default, so if your filenames do not match names used in code, a Mac test will pass but a Linux test will correctly fail. However that is the reverse of your problem so it is probably a red herring.

          Yes, I can reproduce locally.

          • None of the mvn invocations change anything in the failure.
          • hudson.plugins.ansicolor.AnsiColorBuildWrapper$DescriptorImpl is found in target/classes/META-INF/annotations/hudson.Extension

          I'll spend some time in the debugger ...

          Daniel Doubrovkine added a comment - Yes, I can reproduce locally. None of the mvn invocations change anything in the failure. hudson.plugins.ansicolor.AnsiColorBuildWrapper$DescriptorImpl is found in target/classes/META-INF/annotations/hudson.Extension I'll spend some time in the debugger ...

          R. Tyler Croy added a comment -

          dblock, I think there was some missed context here which led to a misunderstanding. The link to the build in Travis definitely writes off the possibility for a developer-local environment problem IMHO.

          I think making the component ansicolor-plugin until we can isolate it further is a good plan.

          I thought this might be a JDK issue since owenmehegan mentioned in this comment that things fail for him when running on OS X with Java 6? A while back we moved the core JRE requirement from JRE6 to JRE7 but it looks like Travis is using JDK7 (java version "1.7.0_45")

          R. Tyler Croy added a comment - dblock , I think there was some missed context here which led to a misunderstanding. The link to the build in Travis definitely writes off the possibility for a developer-local environment problem IMHO. I think making the component ansicolor-plugin until we can isolate it further is a good plan. I thought this might be a JDK issue since owenmehegan mentioned in this comment that things fail for him when running on OS X with Java 6? A while back we moved the core JRE requirement from JRE6 to JRE7 but it looks like Travis is using JDK7 ( java version "1.7.0_45" )

          rtyler Thanks. I've changed the component for this bug, no problem. If you have OSX give this a try, I am not very familiar with Jenkins internals and this is taking a lot of time just to grok

          Daniel Doubrovkine added a comment - rtyler Thanks. I've changed the component for this bug, no problem. If you have OSX give this a try, I am not very familiar with Jenkins internals and this is taking a lot of time just to grok

          Jesse Glick added a comment -

          So you need to see whether DescribableHelper.getDescriptorList includes the instance of AnsiColorBuildWrapper.DescriptorImpl. If so, check findSubtypes and thence coerce. If not, you need to see what is going on in ExtensionList.create and load.

          Jesse Glick added a comment - So you need to see whether DescribableHelper.getDescriptorList includes the instance of AnsiColorBuildWrapper.DescriptorImpl . If so, check findSubtypes and thence coerce . If not, you need to see what is going on in ExtensionList.create and load .

          Matt Hamilton added a comment - - edited

          I'm getting the same error here on our build servers. I've just tried to move to Jenkins 2, and need to get ANSI colour working again. Tried to use this build wrapper, but getting the same error as above. The build slave is OSX:

          iosbuilds$ java -version
          java version "1.8.0_60"
          Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
          Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

          iosbuilds$ uname -a
          Darwin Goram.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

          Let me know if I can help in any way.

          -Matt

          EDIT:

          So seems that case sensitivity may be the issue. Using the wrapper declaration:

          {{wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm', 'defaultFg': 1, 'defaultBg': 2])

          { }}

          Seems to work on OSX.

          -Matt

          Matt Hamilton added a comment - - edited I'm getting the same error here on our build servers. I've just tried to move to Jenkins 2, and need to get ANSI colour working again. Tried to use this build wrapper, but getting the same error as above. The build slave is OSX: iosbuilds$ java -version java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode) iosbuilds$ uname -a Darwin Goram.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64 Let me know if I can help in any way. -Matt EDIT: So seems that case sensitivity may be the issue. Using the wrapper declaration: {{wrap( [$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm', 'defaultFg': 1, 'defaultBg': 2] ) { }} Seems to work on OSX. -Matt

          Teresa Peters added a comment -

          This still reproduces on OSX for me, even with the recommendation above.

          Teresa Peters added a comment - This still reproduces on OSX for me, even with the recommendation above.

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

              Created:
              Updated: