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

ReleaseWrapper should prevent parameter duplication when overrideBuildParameters is not set

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • release-plugin
    • None
    • Release plugin 2.5.4

      When overrideBuildParameters is not enabled, ReleaseWrapper does not attempt to filter default parameters that are also included in the Release configuration and blindly add new parameter regardless of whether a default parameter (from the regular job) has the same name, this results in release builds with confusing duplicated parameters

                  if (isOverrideBuildParameters()) {
                      // if overrideBuildParameters is set, then build params are submitted
                      // within the list of release params -- no need to gather default values
                      paramValues = new ArrayList<ParameterValue>();
                  }
                  else {
      //////////// lack of filtering in regards to getParameterDefinitions()
                      paramValues = getDefaultParametersValues();
                  }
                  
                  if (getParameterDefinitions() != null && !getParameterDefinitions().isEmpty()
                          || overrideBuildParameters &&  getBuildParameterDefinitions() != null && !getBuildParameterDefinitions().isEmpty()) {
      	            JSONObject formData = req.getSubmittedForm();
      	            
      	            JSONArray a = JSONArray.fromObject(formData.get("parameter"));
      
      	            for (Object o : a) {
      	                JSONObject jo = (JSONObject) o;
      	                String name = jo.getString("name");
      
      	                ParameterDefinition d = getParameterDefinition(name);
      	                if(d==null)
      	                    throw new IllegalArgumentException("No such parameter definition: " + name);
      	                
      	                ParameterValue value = d.createValue(req, jo);
      	                
      	                paramValues.add(d.createValue(req, jo));
      	            }
                  } else {
      

            petehayes Peter Hayes
            fchuong Frédéric Chuong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: