jenkinsci / configuration-as-code-plugin Goto Github PK
View Code? Open in Web Editor NEWJenkins Configuration as Code Plugin
Home Page: https://plugins.jenkins.io/configuration-as-code
License: MIT License
Jenkins Configuration as Code Plugin
Home Page: https://plugins.jenkins.io/configuration-as-code
License: MIT License
Need some way to configure users and UserProperties, including (but not limited) to HudsonPrivateSecurityRealm$Details
to pre-configure admin user with a password
Not all Describable instances have @Symbol
defined (e.g. RoleStrategy). In order to support such plugins in custom configurators, it would be great to consult with configurators when Symbol is not found.
yaml with example build slaves configured needs to be available in demos
folder
This should in result become a part of documentation, but first we'll use it to discover possible use cases and create follow up issues.
A customer have many teams, each with their own Jenkins. The teams needs to inherit a standard configuration available, and then add their own team specific configuration.
The standard configuration should be able to be overwritten if the team want to use 99% and not only add to it.
What happens when the standard configuration is updated?
We need a stable CI if we want to safely review PRs and do some refactoring
https://ci.jenkins.io/job/Plugins/job/configuration-as-code-plugin/job/master/7/console
Refresh button - so I can reload configuration from files, without restarting Jenkins
Optional locking down changes in the UI blocking users from changing it without updating the config file
Export configuration - if I have Jenkins already configured, or just made some changes in UI and want to keep them in the file
I have a configuration-as-code demo, which demoes a ci,jenkins.io-alike setup for Pipeline development: https://github.com/oleg-nenashev/demo-jenkins-config-as-code
It would be great to migrate the prototype to CasC so that we get some info from close-to-real instances. It requires #48 and probably patches for some other plugins
as discussed on mailing list
We have no way to guess Descriptor
s data model, until they move to DataBoundSetter
s to "document" their UI databinding.
But this is not enough : Descriptor are mutable objects, and DataBound mechanism don't reset object so some optional attribute becomes null if not-set on UI. So it might be necessary to ask plugin developers to implement the configure(StaplerRequest, JSONObject)
method as:
req.bind(json)
save()
Maybe there's some way to make this the default mechanism ?
When we update the global configuration in jenkins.yml in the git repository, we need the jenkins master to refresh the configuration without restarting.
Even after #47 the plugin does not start up well due to the collisions
The current implementation silently ignores fields with NOOP converters. It is not something preferable IMHO, it would be better to fail initialization in such case
The current Jenkinsfile
in praqma/dev is incompatible with ci.jenkins.io (the CI instance of the Jenkins project that builds all plugins in the @jenkinsci organization) by selecting a node label that just doesn't exist. This adds queue items that never start.
Since we're using a GH org folder, our ability to configure individual projects is limited.
While I personally would advocate for just using that Jenkins instance for all your CI needs, a quick fix could be to just return from the Jenkinsfile if the JENKINS_URL.contains('.jenkins.io')
or similar.
Some attributes are owned by Jenkins
root class for legacy reasons but managed from a web UI point of view using GlobalConfiguration
implementation (typically : security has a dedicated page).
We'd like to be able to discover this from the java codebase so we can mimic in the yaml
model, so
jenkins:
securityRealm: ...
would become :
jenkins:
security:
securityRealm: ...
To make it really easy migrate already running Jenkins instances to Configuration as Code, or to just use Jenkins itself as editor for the YML file an export functionality should be supplied to the user from our UI footprint.
I imagine a kind of Export current configuration
button or link, that will show the current Jenkins configuration as YML and make it easy to download it.
The user can then save the YML file to git and other places, and supply it back to a new or existing Jenkins instance to start using Configuration as Code Plugin.
I would expect also to be able to download the needed plugin.yml
that described the needed plugin on my current instance.
Configuration as code should fully setup Jenkins, so setup wizard should be automatically disabled.
On web UI, tool installers are all configured within Jenkins > Manage > Tools subpage. As we consider the web UI to be some "natural end-user documentation" we want to mimic this in the YAML document structure.
If we install new plugins in the plugin.yml file, how can they be updated without restart as many plugins require restart on update.
WARNING: Caught exception evaluating: it.configurators in /jenkins/plugin/configuration-as-code/. Reason: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
at org.apache.commons.jexl.parser.ASTArrayAccess.evaluateExpr(ASTArrayAccess.java:185)
at org.apache.commons.jexl.parser.ASTIdentifier.execute(ASTIdentifier.java:75)
at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:74)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61)
at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsIterator(ExpressionSupport.java:94)
at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:89)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:95)
at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:112)
at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:140)
at org.kohsuke.stapler.IndexViewDispatcher.dispatch(IndexViewDispatcher.java:30)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:86)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:92)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Configuration-as-Code can't handle type class hudson.security.LegacySecurityRealm
at org.jenkinsci.plugins.casc.Configurator.lookup(Configurator.java:85)
at org.jenkinsci.plugins.casc.HeteroDescribableConfigurator.lambda$getConfigurators$0(HeteroDescribableConfigurator.java:33)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.jenkinsci.plugins.casc.HeteroDescribableConfigurator.getConfigurators(HeteroDescribableConfigurator.java:34)
at org.jenkinsci.plugins.casc.ConfigurationAsCode.listElements(ConfigurationAsCode.java:82)
at org.jenkinsci.plugins.casc.ConfigurationAsCode.getConfigurators(ConfigurationAsCode.java:53)
... 93 more
On host/plugin/configuration-as-code the helpful documentation can be found, but it is hard to read due to indentation and layout.
As a user I would like a simple styling making the indentation very visual and match the YAML configuration I'm supposed to write.
A very simple layout with font's and other styling helping read it would be nice as well. Maybe a also a table of content.
hudson.security.AuthorizationStrategy.Unsecured has no DataBoundConstructor. From configuration-as-code point of view it appears as a custom implementor for newinstance
that we can't support.
Maybe we can introduce as an extended convention to search enclosing class for a constant with same name (i.e UNSECURED
).
How can we test that YML file is persisted as the exact global configuration I imagine…
Current prototype do load configuration from ./jenkins.yaml
We force sure want more flexibility
Defining an SPI for configuration source that a complementary plugin can implement would make this flexible enough to support extensibility to various use-cases.
we're trying to mimic UI as much as possible, but our current solution doesn't support it
in UI we have
when in yaml it's
can we maybe treat each element UNDER jenkins as root element? so it can be matched with RootElementConfigurators even if it's not a root in yaml? does it even make sense?
def jdkInstaller = jenkins.model.Jenkins.instance.getDescriptor(hudson.tools.JDKInstaller)
jdkInstaller.doPostCredential("user", "password")
Rile Strategy plugin has a complex Authorization configuration logic, which use custom logic in Descriptors. So CasC plugin won't support it OOTB, but the plugin is an important part of the plugin ecosystem. I would like to add the plugin support, the implementation and code location is TBD
LSP would enable support within IDEs (vscode, eclipse...) for configuration-as-code syntax.
CredentialsRootConfigurator extension has Credentials class existence check neither in declaration nor in static declarator. In such case the extension will be loaded and then it will eventually cause class not found exception if used.
If we have all global configuration as CasC, we still need to get at least one job up and running to start with that can create all job- and view-related things. This is not part of CasC, so maybe this should be a feature of our container docker4jcasc much like the old one contribute with this genesis seedjob thing.
There are conflicting dependencies in the plugin, ideally they should be resolved so that we have no library conflicts
short document describing the process of contributing changes to the plugin
To help new users try the concept, there should be a Jenkins Configuration as Code Docker image available that can be started with a pointer to a configuration spinning up a new Jenkins from scratch with the configuration given.
I expect to be the usual Jenkins LTS image, with only two modifications:
describe how to proceed when someone wants to migrate existing traditionally configured Jenkins to as-code solution
Bit confusing to see this message when we actually only today are working in the jenkinsci fork.
We should clean up so they are in sync, or a least the the jenkinsci fork in front.
As being part of Praqma I like this really cool initiative is forked from Praqma's github account, but it doesn't constitute a really good excuse to make it look like a mess.
We also had one contribution to our Praqma repo... so users might also be confused.
If it isn't easy to clean up, we can have Github support staff break the fork.
Hi,
I've tried to express that with the current version without success:
import jenkins.security.s2m.AdminWhitelistRule
import jenkins.model.Jenkins
Jenkins.instance.injector.getInstance(AdminWhitelistRule).masterKillSwitch = false
I believe it will have to be some glue code here.
on praqma/dev branch we have implemented support for reading location of jenkins.yaml file from environment variable, that can point to local file, or repository - maybe it's time to move this functionality to master branch?
To show the concept for real and running we have discussed to have a demon instance running live people can visit and also browse the documentation and configuration of as we propose it to be used.
We can host such one in Praqma, and I see two options for us:
No matter what option we go for, we should point the users to this "demo" instance as an example and supply them with information like:
jenkins.yml
and plugin.yml
files - public repositoryHandling credentials as code may not be a trivial issue, from security and usability point of view.
The way it was used in the old JAC version is not satisfying - keep credentials, like passwords, in a plain text file under .ssh directory on a host machine.
When deploying Jenkins remotely it meant you had to ssh to the machine and create files there, then JAC redeployment - heavy operation just to add credentials... No better solution in my head yet, but maybe it's time to start discussing it.
There is a plugin to maintain build slaves, allowing slave administrators to configure their slaves. How can that work if the slave configuration is in our new jenkins.yml file? The customer said they have delegated responsibility for this configuration based on the ownership plugin.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.