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

Not able to overwite Custom Job Parameters using Jenkins file or Jenkins pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • groovy-plugin
    • None
    • PPE

      Hi Team,

      Currently we are facing critical issues on using Jenkins File or Pipeline to overwrite the Custom Job parameters.

      Pipeline or Jenkins file is not allowing to use the 
      def build= Thread.currentThread()?.executable
      Getting below error
      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified field java.lang.Thread executable
      I tried inline pipeline also enabling and disabling the Use Groovy Sandbox option once its enable getting the above RejectedAccessException Error if I disable I am getting the below error
      groovy.lang.MissingPropertyException: No such property: executable for class: java.lang.Thread
       

      Could you please let me know how we can update the Custom Job parameter on workflow and this needs to be used in other stages of the pipeline. Since our deployment scripts will read the Parameter vale from UNIX. Initially the value will be null based on some conditions we will update the parameter. 

       

      We tried the below option also.

       

      def newbuildparms =[:]
      newbuildparms.put('$Param1', 'TestOverwrite')

      setBuildParameters(newbuildparms)

       

      def setBuildParameters(map) {
      def npl = new ArrayList<StringParameterValue>()
      for (e in map) {
      npl.add(new StringParameterValue(e.key.toString(), e.value.toString()))
      }
      def newPa = null
      newPa = new ParametersAction(npl)

      build.actions.add(newPa)
      }

       

      This throws below error
      java.io.NotSerializableException: java.util.LinkedHashMap$Entry
       

      We tried all the options nothing worked us.

      We are not able to achieve this and its always going as null when read the parameter from outside of jenkins, we are not able to update the current job parameters in workflow.

      Jenkins version 2.19.1

      Regards

      Jayaram

            vjuranek vjuranek
            jayaram_s jayaram s
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: