Closed darxriggs closed 5 years ago
So far the exported config just contains the configurations
property.
Example:
hudson.ivy.IvyBuildTrigger.xml
<?xml version='1.0' encoding='UTF-8'?>
<hudson.ivy.IvyBuildTrigger_-DescriptorImpl plugin="ivy@1.28">
<configurations>
<hudson.ivy.IvyBuildTrigger_-IvyConfiguration>
<name>setting1</name>
<ivyConfPath>file1.xml</ivyConfPath>
</hudson.ivy.IvyBuildTrigger_-IvyConfiguration>
<hudson.ivy.IvyBuildTrigger_-IvyConfiguration>
<name>setting2</name>
<ivyConfPath>file2.xml</ivyConfPath>
</hudson.ivy.IvyBuildTrigger_-IvyConfiguration>
</configurations>
<extendedVersionMatching>true</extendedVersionMatching>
</hudson.ivy.IvyBuildTrigger_-DescriptorImpl>
exported configuration
unclassified:
ivyBuildTrigger:
configurations:
- ivyConfPath: "file1.xml"
name: "setting1"
- ivyConfPath: "file2.xml"
name: "setting2"
The extendedVersionMatching
property is contained in the generated documenation and JSON schema but is not exported. Having invested some decent amount of time, I still don't understand why it is missing.
@casz / @ndeloof can you give me some hint want I am missing?
@darxriggs for what reason are the fields marked volatile, perhaps it has something to do with it?
@casz I already tried with removed volatile
and @CopyOnWrite
. There is no effect on the exported config.
@casz / @ndeloof I have found the cause - see my comment here https://github.com/jenkinsci/configuration-as-code-plugin/commit/c9faa3119bab5e9b02e575e1e65f56051c1e9b4f#r32624910.
If I comment out if (attribute.equals(instance, reference)) continue;
in BaseConfigurator
then extendedVersionMatching
is also exported.
Any comments on this?
Import Configuring the plugin via JCasC is now working correctly.
Export
Exporting the config to YAML doesn't work 100% (not all properties are exported). This is due to the load()
method used in constructors in combination with how JCasC is implemented. This could also be fixed using https://javadoc.jenkins.io/hudson/model/PersistentDescriptor.html. For the moment I decided against it, as it would require at least Jenkins 2.140.
@darxriggs could you not just implement PersistentDescriptor? and add remove once +2.140?
@casz Just implementing PersistentDescriptor
is not sufficient. The load()
method is annotated with @PostConstruct
. This annotation is only evaluated on extensions with Jenkins 2.140 - see https://github.com/jenkinsci/jenkins/commit/c3988aae8ad66fde529830e799fe3d49cd241ebb. Therefore when I would remove calling the load()
method in the constructor the configuration would not be loaded from disk on old Jenkins installations.
PersistentDescriptor has been introduced in 2.140 so that this behaviour change is homogeneous. Just update minimal required version
@ndeloof Exactly. Thanks for the info. We were just discussing the case when the minimum required Jenkins version is not yet upgraded to Jenkins 2.140.
@arothian Are you ok with upgrading the minimum required Jenkins version to 2.140? Then I would prepare an additional commit so that exporting the configuration with JCasC would be correct too.
Fine by me
Consider targeting an LTS release 😄
@casz Thanks for the hint. I have followed this procedure in the past for some other plugins. But I am more and more of the opinion that just the minimal required version should be used and that a new plugin version should not force to user to upgrade to an LTS release.
@arothian Now this pull request is ready for review and merge.
@arothian can you provide an estimate when this change can be released via a new plugin version?
Given this update and the other jenkins version requirements updates, I'll drop a 2.0 release with these changes within the next few days.
much appreciated
This is still work in progress... I have to adapt all the data-binding to make the UI work (again).