Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JENKINS-69771 Make listSize parameter optional #20

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JayZ-star
Copy link

@JayZ-star JayZ-star commented Nov 6, 2023

Fixes issue JENKINS-69771

Release 0.0.11 included fix for listSize which made the listSize parameter now functional. However the way it was implemented also meant that listSize as a new parameter must be supplied and older parameter definition setup without a listSize parameter will cause the pipeline load to fail.

This change sets up parameter overloading for ListGitBranchesParameterDefinition so that if a listSize parameter is not supplied the default DEFAULT_LIST_SIZE of 5 is used instead, making the plugin backwards compatible with older pipeline parameter definition files made with 0.0.9 and earlier versions of the plugin.

Testing done

1. Replicating the issue:
image
Jenkins test instance, setup with listGitBranches 0.0.13

image
Issue described in JENKINS-69771 recreated

image
Issue is due to calling listGitBranches plugin with no listSize parameter, as this pipeline was defined with release 0.0.9 in mind.

2. Running test version:
image
Experimental hpi compiled from this branch deployed into test Jenkins instance

image
Running the same job again, the job is now successful in loading jobs from pipeline files.

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
    Options
  2. Ensure that the pull request title represents the desired changelog entry
    Options
  3. Please describe what you did
    Options
  4. Link to relevant issues in GitHub or Jira
    Options
  5. Link to relevant pull requests, esp. upstream and downstream changes
    Options
  6. Ensure you have provided tests - that demonstrates feature works or fixes the issue
    Options

…o handle cases when listSize is not supplied (0.0.9 and earlier style call)
@JayZ-star
Copy link
Author

@huangsuoyuan can you please review this PR?

JayZ-star and others added 3 commits November 7, 2023 14:49
…ter/ListGitBranchesParameterDefinition.java

Co-authored-by: RobinFauvel <robin.fauvel@yahoo.fr>
…ter/ListGitBranchesParameterDefinition.java

Co-authored-by: RobinFauvel <robin.fauvel@yahoo.fr>
Comment on lines +70 to +82
super(name, description);
this.remoteURL = remoteURL;
this.credentialsId = credentialsId;
this.defaultValue = defaultValue;
this.uuid = UUID.randomUUID();
this.sortMode = sortMode;
this.selectedValue = selectedValue;
this.quickFilterEnabled = quickFilterEnabled;
this.listSize = DEFAULT_LIST_SIZE;

setType(type);
setTagFilter(tagFilter);
setBranchFilter(branchFilter);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super(name, description);
this.remoteURL = remoteURL;
this.credentialsId = credentialsId;
this.defaultValue = defaultValue;
this.uuid = UUID.randomUUID();
this.sortMode = sortMode;
this.selectedValue = selectedValue;
this.quickFilterEnabled = quickFilterEnabled;
this.listSize = DEFAULT_LIST_SIZE;
setType(type);
setTagFilter(tagFilter);
setBranchFilter(branchFilter);
this(name, description, remoteURL, credentialsId, defaultValue, sortMode, selectedValue, quickFilterEnabled, type, tagFilter, branchFilter,
DEFAULT_LIST_SIZE);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants