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

Active Choices plugin blocks using Jenkins.instance.getItemByFullName method from shared library

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • active-choices-plugin
    • None
    • Jenkins 2.346.3
      Plugin version 2.6.3
      Jenkins in k8s cluster (1.22.4)

    Description

      I have a helper function in shared library which retrieves build description by job name and build number. When I add active choice parameters to Jenkins pipeline, this function stops working, Jenkins.instance.getItemByFullName returns null.

      Removing Active choice parameters restores the functionality and Jenkins.instance.getItemByFullName returns build object.

      I've tried enabling and disabling sandbox for Active Choice paramters' scripts, but it doesn't change the situation.

      Moving the helper function's code from shared library to Jenkinsfile solves the problem and the function returns a build object.

       

      Steps to reproduce:

      1. Create shared library with function from attachments.
      2. Create a pipeline which used this shared libarary.
      3. Add active choice paramter (I had 1 active choice and 1 active choice reactive parameters).
      4. Run pipeline and observe error "java.lang.NullPointerException: Cannot invoke method getDescription() on null object" in job's log.
      5. Remove reference to shared library and define function in pipeline instead.
      6. Run pipeline and observe build description in output.

      Attachments description:

      Attachments

        1. config.xml
          5 kB
          Valeriy Zabawski
        2. getBuildDescription.groovy
          0.3 kB
          Valeriy Zabawski
        3. Jenkinsfile
          0.4 kB
          Valeriy Zabawski

        Activity

          People

            kinow Bruno P. Kinoshita
            dziki_jam Valeriy Zabawski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: