Skip to content

Conversation

@tilln
Copy link
Contributor

@tilln tilln commented Aug 22, 2019

The Performance Publisher's "Expert Mode" currently has two options for "Relative Constraints":

  • Compare with number of previous builds
  • Compare with builds within a time frame

However, there is no option to compare with a specific build number (which even the "Standard Mode" can do).

Since the addition of the baseline build setting in #178 for calculating report tables, it would make sense to use the same baseline build for "Relative Constraint" evaluations.

The challenge is not to break existing Jobs and Pipelines, which this PR addresses by leaving existing configuration fields and their existing values unchanged, but changing them to a String field with the same representation, namely in PreviousResultsBlock:

public static final String PREVIOUS = "true", TIMEFRAME = "false", BASELINE = "BASELINE";
private String choicePreviousResults = TIMEFRAME; // keep field name for backward compatibility

This way existing Freestyle config.xml and Pipeline DSL calls keep working by unmarshalling the former Boolean values into Strings.

@artem-fedorov artem-fedorov self-requested a review August 22, 2019 12:05
*/
private boolean choicePreviousResults;
public static final String PREVIOUS = "true", TIMEFRAME = "false", BASELINE = "BASELINE";
private String choicePreviousResults = TIMEFRAME; // keep field name for backward compatibility
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about backward compatibility?
Does this class will load from file storage without any problems? or this class should have readResolve method for migrate boolean field to new String? https://wiki.jenkins.io/display/JENKINS/Hint+on+retaining+backward+compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip about readResolve. I tested it and it does work without.
Because there are no new fields added that would need a non-trivial initial value when hydrating config back from XML, nor renamed fields that would need a value copied from the old field.
Otherwise, when creating a new config/pipeline, the @DataBoundConstructor will be used and the String value gets initialized with a correct (non-null) value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great! Thanks!

@artem-fedorov
Copy link
Collaborator

Hello @tilln
Thank you for your PR, please look at my comment above

@artem-fedorov artem-fedorov merged commit ea776c1 into jenkinsci:master Aug 28, 2019
@tilln tilln deleted the feature/relative-constraint-compare-with-baseline branch August 30, 2019 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants