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

JIRA_ISSUE_KEY is not set in Pipeline jobs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • jira-trigger-plugin
    • None
    • Jenkins installed on windows machine

      Tried to retrieve the Env variable Jira issue key while running job. getting all the details except Jira details.

      Groovy code:: 

       

      import java.lang.*
      import java.util.*
      import java.io.*
      import java.net.*
      import groovy.lang.*
      import groovy.util.*
      import java.math.BigInteger
      import java.math.BigDecimal
      
      def printParams() {
        env.getEnvironment().each { name, value -> println "Name: $name -> Value $value" }
        fields.find { it.id == "JIRA_ISSUE_KEY" }.value
      }
      
      printParams()
      
      def env = System.getenv()
      
      //Print all the environment variables.
      env.each { println it }
      
      // You can also access the specific variable, say 'username', as show below 
      String user = env['$JIRA_ISSUE_KEY']
      println user
      
      //println ${environment::get-variable('bamboo_buildNumber')}
      println "The issue is: ${env.JIRA_ISSUE_KEY}"
      
       

      o/p:: JIRA_ISSUE_KEY value is getting null
       
      console o/p:: 
       

       JIRA issue is updated
       Running in Durability level: MAX_SURVIVABILITY
       [Pipeline] echo
       Name: BUILD_DISPLAY_NAME -> Value #65
       [Pipeline] echo
       Name: BUILD_ID -> Value 65
       [Pipeline] echo
       Name: BUILD_NUMBER -> Value 65
       [Pipeline] echo
       Name: BUILD_TAG -> Value jenkins-PipeLine Navigator-65
       [Pipeline] echo
       Name: BUILD_URL -> Value 
       http://localhost:8080/job/PipeLine%20Navigator/65/
       [Pipeline] echo
       Name: CLASSPATH -> Value 
       [Pipeline] echo
       Name: HUDSON_HOME -> Value C:\Users\SDWA-190\.jenkins
       [Pipeline] echo
       Name: HUDSON_SERVER_COOKIE -> Value 272877dd9d388ea0
       [Pipeline] echo
       Name: HUDSON_URL -> Value 
       http://localhost:8080/
       [Pipeline] echo
       Name: JENKINS_HOME -> Value C:\Users\SDWA-190\.jenkins
       [Pipeline] echo
       Name: JENKINS_SERVER_COOKIE -> Value 272877dd9d388ea0
       [Pipeline] echo
       Name: JENKINS_URL -> Value 
       http://localhost:8080/
       [Pipeline] echo
       Name: JOB_BASE_NAME -> Value PipeLine Navigator
       [Pipeline] echo
       Name: JOB_DISPLAY_URL -> Value 
       http://localhost:8080/job/PipeLine%20Navigator/display/redirect
       [Pipeline] echo
       Name: JOB_NAME -> Value PipeLine Navigator
       [Pipeline] echo
       Name: JOB_URL -> Value 
       http://localhost:8080/job/PipeLine%20Navigator/
       [Pipeline] echo
       Name: RUN_CHANGES_DISPLAY_URL -> Value 
       http://localhost:8080/job/PipeLine%20Navigator/65/display/redirect?page=changes
       [Pipeline] echo
       Name: RUN_DISPLAY_URL -> Value 
       http://localhost:8080/job/PipeLine%20Navigator/65/display/redirect
       [Pipeline] echo
       LOCALAPPDATA=C:\Users\SDWA-190\AppData\Local
       [Pipeline] echo
       PROCESSOR_LEVEL=6
       [Pipeline] echo
       FP_NO_HOST_CHECK=NO
       [Pipeline] echo
       VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
       [Pipeline] echo
       USERDOMAIN=SDWA-190-PC
       [Pipeline] echo
       LOGONSERVER=
       SDWA-190-PC
       [Pipeline] echo
       JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102
       [Pipeline] echo
       PROMPT=$P$G
       [Pipeline] echo
       SESSIONNAME=Console
       [Pipeline] echo
       ALLUSERSPROFILE=C:\ProgramData
       [Pipeline] echo
       PROCESSOR_ARCHITECTURE=AMD64
       [Pipeline] echo
       PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\Java\jdk1.8.0_102\bin
       [Pipeline] echo
       SystemDrive=C:
       [Pipeline] echo
       APPDATA=C:\Users\SDWA-190\AppData\Roaming
       [Pipeline] echo
       JAVA_TOOL_OPTIONS=-Djdk.http.auth.tunneling.disabledSchemes=""
       [Pipeline] echo
       USERNAME=SDWA-190
       [Pipeline] echo
       windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
       [Pipeline] echo
       ProgramFiles(x86)=C:\Program Files (x86)
       [Pipeline] echo
       CommonProgramFiles=C:\Program Files\Common Files
       [Pipeline] echo
       Path=C:\Program Files\Java\jdk1.8.0_102\bin;C:\Program Files (x86)\VMware\CobraWinLDTP\;D:\apache-maven-3.2.2-bin\apache-maven-3.2.2\bin;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs
       [Pipeline] echo
       PYTHONPATH=C:\Program Files (x86)\VMware\CobraWinLDTP\
       [Pipeline] echo
       PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
       [Pipeline] echo
       OS=Windows_NT
       [Pipeline] echo
       windows_tracing_flags=3
       [Pipeline] echo
       COMPUTERNAME=SDWA-190-PC
       [Pipeline] echo
       PROCESSOR_REVISION=3c03
       [Pipeline] echo
       CLASSPATH=.;C:\Program Files\Java\jdk1.8.0_102\lib;C:\Program Files\Java\jdk1.8.0_102\jre\lib
       [Pipeline] echo
       CommonProgramW6432=C:\Program Files\Common Files
       [Pipeline] echo
       ComSpec=C:\Windows\system32\cmd.exe
       [Pipeline] echo
       ProgramData=C:\ProgramData
       [Pipeline] echo
       ProgramW6432=C:\Program Files
       [Pipeline] echo
       =D:=D:\Jenkins
       [Pipeline] echo
       HOMEPATH=\Users\SDWA-190
       [Pipeline] echo
       SystemRoot=C:\Windows
       [Pipeline] echo
       TEMP=C:\Users\SDWA-190\AppData\Local\Temp
       [Pipeline] echo
       HOMEDRIVE=C:
       [Pipeline] echo
       PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
       [Pipeline] echo
       USERPROFILE=C:\Users\SDWA-190
       [Pipeline] echo
       TMP=C:\Users\SDWA-190\AppData\Local\Temp
       [Pipeline] echo
       M2_HOME=D:\apache-maven-3.2.2-bin\apache-maven-3.2.2
       [Pipeline] echo
       CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
       [Pipeline] echo
       ProgramFiles=C:\Program Files
       [Pipeline] echo
       PUBLIC=C:\Users\Public
       [Pipeline] echo
       NUMBER_OF_PROCESSORS=4
       [Pipeline] echo
       windir=C:\Windows
       [Pipeline] echo
       =::=::\
       [Pipeline] echo
       ST_INSTALL_PATH=C:\Program Files (x86)\HP\Unified Functional Testing\
       [Pipeline] echo
       null
       [Pipeline] echo
       The issue is: null
       [Pipeline] End of Pipeline
       Finished: SUCCESS
        
      

       

            ceilfors Wisen Tanasa
            rokkamgovardhan govardhan reddy
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: