Configuration as Code tooling proposal#111
Configuration as Code tooling proposal#111bitwiseman merged 7 commits intojenkinsci:masterfrom ndeloof:jep-submission
Conversation
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
|
|
||
| This includes: | ||
|
|
||
| - tooling to validate configuration, sort of a "dry-run" mode, with adequate diagnostic when some |
|
issue raised some discussions already and we won't find a silver bullet, but if we have a dry run I can live with proposed solution 👍 |
|
@ndeloof Are you asking for commentary from me as a JEP editor or as a contributor? As an editor, I would say theres a bunch of stuff to be cleaned up (the |
|
@bitwiseman your comment is actually useful for me to understand which information are required for such a JEP. I have to admit this highly standardized process is a new way for me to consider software development |
jglick
left a comment
There was a problem hiding this comment.
Is there a reason this is not simply part of JEP-201? From my PoV, if a proposed new feature requires new tooling to be practical, then that is all part of the development of that feature.
(If 201 were final, then a follow-up JEP would of course be the only option.)
jep/0000/README.adoc
Outdated
| | Not Submitted :information_source: | ||
|
|
||
| | Type | ||
| | :bulb: Informational :bulb: |
There was a problem hiding this comment.
None of the proposed types do actually match what I try to express in this JEP. Sounds "Standards" is what is used for this purpose, but I'm not defining a standard here, just exploring the concrete tools that would help JEP-201 adoption.
jep/0000/README.adoc
Outdated
|
|
||
| == Abstract | ||
|
|
||
| Configuration-as-Code (JEP-201) do describe the mechanisms used to configure a Jenkins master based |
jep/0000/README.adoc
Outdated
| for each and every supported plugin. | ||
|
|
||
| This approach comes with some drawback: Any update to Jenkins master's core or plugins will change the | ||
| inferred model, and as such a yaml configuration used a t time might not be valid a t+1. This concern |
jep/0000/README.adoc
Outdated
| Configuration-as-Code tooling is designed to fill the gap between the raw mechanism defined by JEP-201 | ||
| to configure a specific jenkins-core + plugins combination, and the need to keep this configuration | ||
| stable during core or plugin upgrades, or at least detect breaking changes and provide hints to manage | ||
| upgreade. |
jep/0000/README.adoc
Outdated
| == Motivation | ||
|
|
||
| Configuration-as-Code doesn't define a data model to setup jenkins, it's based on inferring a model | ||
| from live jenkins instance from it's Java API, especially UI data-binding mechanisms. Based on this, |
jep/0000/README.adoc
Outdated
| instance. This toolkit do parse the yaml configuration, try to apply configuration on the inferred model, | ||
| and will report issue detected during this dry-run configuration process. | ||
|
|
||
| It would rely on breaking changes metadata to offer end-user some guidance on way to address repoerted |
| === Before applying configuration | ||
|
|
||
| On end-user side we want ot offer a validation toolkit to be used when applying configuration on a jenkins | ||
| instance. This toolkit do parse the yaml configuration, try to apply configuration on the inferred model, |
There was a problem hiding this comment.
BTW please follow the formatting model of one physical (AsciiDoc) text line per sentence or major phrase. Easier to read diffs and so on.
| == Infrastructure Requirements | ||
|
|
||
| If approved, Configuration-as-Code tooling to check for API backward compatibility will need to be | ||
| included in the CI process, so it can inform plugin developers and contributors on breaking changes |
There was a problem hiding this comment.
Meaning what, exactly? That an incompatible change to databinding produces a build failure? Even assuming the other pieces have been developed, this is not trivial as you need to determine a baseline to compare against, which presumably means looking up the most recent Maven release older than the current snapshot.
There was a problem hiding this comment.
Good point. I expected to compare with previous commit or pull-request baseline, but this assumes some way to store the inferred model between builds.
There was a problem hiding this comment.
You need not necessary “store an inferred model between builds”. You can have a build compute the old model almost as easily as it computes the new model. But you need some way to deterministically identify the “old version”.
| plugin developers to document required breaking changes, and validate a configuration for a specific | ||
| jenkins instance before it get actually applied. | ||
|
|
||
| == Reasoning |
There was a problem hiding this comment.
Something not addressed in JEP-201 itself is why you chose to use databinding (~ DescribableModel) as the source of truth, when plugins have traditionally maintained settings compatibility via their XStream form (~ fields, readResolve)—we do presume already that a config.xml which worked in an older “version” of Jenkins can be loaded safely in a newer version. Thus JEP-201 is introducing an additional compatibility constraint: plugin developers need to be aware of, and work around, both models when refactoring settings.
(Pipeline was already imposing a similar constraint for Steps and those Describables being used inside Steps. OTOH it also allows StepDescriptor.newInstance / .uninstantiate to be overridden to customize the process, as I in fact did recently in jenkinsci/docker-workflow-plugin#138. This is not available when sharing code with freestyle via CoreStep / CoreWrapperStep. I think job-dsl also introduced the ability to introspect stuff and pay attention to @Symbol but AFAIK most bindings are still hand-written.)
There was a problem hiding this comment.
see https://github.com/jenkinsci/jep/blob/master/jep/201/README.adoc#mimic-web-ui
As we want to translate web UI into -as-code configuration the source of truth is the web UI, so the databinding it uses to translate into java objects.
If you suggest we rely on xml persistence binding as sours of truth, then we need to fully revisit CasC design so it becomes an xml auto-magic templating engine. Maybe this makes sense.
There was a problem hiding this comment.
While I would personally favor XML over UI, especially in the face of the blue-ification of Jenkins, going with XML serialized form has essentially the same objection of being tied to a legacy format we'd like to get rid of.
Its pro remains the lesser need for compatibility (and one that has been well established), although the current approach's need for greater awareness of API compatibility could also address problems we occasionally see related to plugins dependencies.
There was a problem hiding this comment.
About this consideration to better rely on XStream serialisation as a proven backward compatible model for jenkins data and build configuration-as-code on it : if this is what you're looking for, then you don't need a plugin for this purpose: just commit all your XML files in SCM and you're done.
jep/0000/README.adoc
Outdated
|
|
||
| Configuration-as-Code tooling is defined to workaround this limitation by providing a toolset to | ||
| discover such breaking changes early, before the actual production configuration is updated. | ||
| It will help detect breaking changes during jenkins and plugins developement, offer an option for |
|
@jglick I proposed another JEP following Jenkins Essentials model to have smaller JEPs focussed on some aspect of a general topic |
| == Abstract | ||
|
|
||
| Configuration-as-Code (JEP-201) describes the mechanisms used to configure a Jenkins master based | ||
| on yaml file(s), by discovering the data model from Java API, without the need to write any "glue-code" |
There was a problem hiding this comment.
I might be late here, but asking anyways. Is the no "glue-code" design approach already taken?
I think UX is important in APIs, and having all the internal core & plugins model in this public API is bad IMO.
This deserves a whole JEP, but briefly: what about starting a "Define your public API" campaign? If every Describable had a public data API then Configuration as Code (the REST API also and probably others) would benefit from it. Current approach (introspecting describables) could be used as fallback if Describable#getPublicAPI (or the like) is not implemented.
There was a problem hiding this comment.
Having a "Configurable" API implemented by all plugin would indeed ensure the API is well handled by plugin maintainer and that it correctly reflects the configurable elements of a plugin, but doing so would require years before we get good coverage from all major plugins (just see how long it took for pipeline adoption).
By the way, this "no glue code" approach, based on UI databing exposed model, is not as bad as you can expect, and easy for plugin maintainer to improve as it relies on the databinding mechanisms they're used to.
There was a problem hiding this comment.
@amuniz
What you suggest is not in opposition to avoiding glue-code. The details of this should be discussed in this upcoming JEP submission for Jenkins CasC Schema.
There was a problem hiding this comment.
upcoming JEP submission for Jenkins CasC Schema
Sorry, I might be a bit lost... is not the schema already defined? It is using the existing model with @DataBoundContructor/@DataBoundSetter introspection, isn't it?
There was a problem hiding this comment.
This will be presented in more details (reasoning, wroakrounds, etc) in #125
bitwiseman
left a comment
There was a problem hiding this comment.
@ndeloof @ewelinawilkosz
Will one of you be the sponsor of this JEP? That is the last blocker I see right now to this JEP becoming Draft.
@ewelinawilkosz
@bitwiseman
@rtyler