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

no known implementation of class jenkins.tasks.SimpleBuildWrapper

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: ansicolor-plugin
    • Labels:
      None
    • Environment:
      fails on OSX, works on Linux
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          dblock Daniel Doubrovkine created issue -
          Hide
          jglick 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.

          Show
          jglick 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.
          jglick Jesse Glick made changes -
          Field Original Value New Value
          Resolution Cannot Reproduce [ 5 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          dblock Daniel Doubrovkine added a comment - - edited

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

          Show
          dblock Daniel Doubrovkine added a comment - - edited Jesse Glick 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.
          Hide
          dblock 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.

          Show
          dblock 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.
          Hide
          jglick 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.

          Show
          jglick 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.
          Hide
          dblock 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.

          Show
          dblock 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.
          dblock Daniel Doubrovkine made changes -
          Component/s ansicolor-plugin [ 15995 ]
          Hide
          dblock 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 Jesse Glick feels like closing it again I won't object.

          Show
          dblock 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 Jesse Glick feels like closing it again I won't object.
          dblock Daniel Doubrovkine made changes -
          Assignee Jesse Glick [ jglick ] Daniel Doubrovkine [ dblock ]
          Resolution Cannot Reproduce [ 5 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          jglick 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.

          Show
          jglick 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.
          rtyler R. Tyler Croy made changes -
          Description A straightforward JUnit test is failing on OSX and succeeds on Linux, presumably this means the implementation will be broken on OSX as well.

          {quote}
          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>.*"));
                      }
                  });
              }

          }{quote}

          {quote}
          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)
          {quote}

          See https://github.com/dblock/jenkins-ansicolor-plugin/pull/60.
          A straightforward JUnit test is failing on OSX and succeeds on Linux, presumably this means the implementation will be broken on OSX as well.

          {code}
          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>.*"));
                      }
                  });
              }

          }
          {code}

          {code}
          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)
          {code}

          See https://github.com/dblock/jenkins-ansicolor-plugin/pull/60.
          Hide
          jglick 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.

          Show
          jglick 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.
          Hide
          dblock 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 ...

          Show
          dblock 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 ...
          Hide
          rtyler R. Tyler Croy added a comment -

          Daniel Doubrovkine, 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 Owen Mehegan 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")

          Show
          rtyler R. Tyler Croy added a comment - Daniel Doubrovkine , 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 Owen Mehegan 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" )
          dblock Daniel Doubrovkine made changes -
          Component/s workflow-plugin [ 18820 ]
          Hide
          dblock Daniel Doubrovkine added a comment -

          R. Tyler Croy 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

          Show
          dblock Daniel Doubrovkine added a comment - R. Tyler Croy 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
          Hide
          jglick 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.

          Show
          jglick 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 .
          davidkarlsen davidkarlsen made changes -
          Assignee Daniel Doubrovkine [ dblock ] davidkarlsen [ davidkarlsen ]
          davidkarlsen davidkarlsen made changes -
          Assignee davidkarlsen [ davidkarlsen ] Daniel Doubrovkine [ dblock ]
          Hide
          hammertoe 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

          Show
          hammertoe 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
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 166192 ] JNJira + In-Review [ 186323 ]
          Hide
          tpeters Teresa Peters added a comment -

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

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

            People

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

              Dates

              Created:
              Updated: