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

ReleaseWrapper should prevent parameter duplication when overrideBuildParameters is not set

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: release-plugin
    • Labels:
      None
    • Environment:
      Release plugin 2.5.4
    • Similar Issues:

      Description

      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 {
      

        Attachments

          Activity

          There are no comments yet on this issue.

            People

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

              Dates

              • Created:
                Updated: