| The BUILD_USER_* variables were init by plugin "Jenkins user build vars plugin", this plugin execute after plugin " Build Name and Description Setter". when you configure the plugin "Build Name and Description Setter", you can choose "Set build name before build starts" or "Set build name after build ends". The two plugin execution sequence maybe like this: ①"Build Name and Description Setter" if you choose "Set build name before build starts" --> ②"Jenkins user build vars plugin" init BUILD_USER_* variables --> ③"Build Name and Description Setter" if you choose "Set build name after build ends". The order of execution is determined by "Extension ordinal value", but the two plugin set this value is zero. so the order is determined by getDisplayName() value. the displayname one is "Set Build Name" another is "Set jenkins user build variables". the source code is here
/**
* Sort {@link ExtensionComponent}s in the descending order of {@link #ordinal()}.
*/
public int compareTo(ExtensionComponent<T> that) {
double a = this.ordinal();
double b = that.ordinal();
if (a>b) return -1;
if (a<b) return 1; // make the order bit more deterministic among extensions of the same ordinal
if (this.instance instanceof Descriptor && that.instance instanceof Descriptor) {
try {
return Util.fixNull(((Descriptor)this.instance).getDisplayName()).compareTo(Util.fixNull(((Descriptor)that.instance).getDisplayName()));
} catch (RuntimeException | LinkageError x) {
LOG.log(Level.WARNING, null, x);
}
}
return this.instance.getClass().getName().compareTo(that.instance.getClass().getName());
}
Is my analysis correct ??? |