Comments (12)
I wouldn't say so - we're putting some elements under 'jenkins' so it mimics UI - we configure Mailer under 'Configure System' in Jenkins and that's the 'jenkins' root element
Plugins have separate subpage, 'Manage Plugins' so in my opinion 'plugins' deserves to be root element itself - if that's possible
from configuration-as-code-plugin.
By the way, about
Field f = Jenkins.class.getDeclaredField("proxy");
f.set(Jenkins.getInstance(), pcc);
proxy being public, you can just write Jenkins.getInstance.proxy = pcc
from configuration-as-code-plugin.
I don't expect configuration-as-code to fix all jenkins design issues :-P
configuration-as-code could easily check a required list of plugin is installed, as some sort of a company policy check. But installing plugins is a distinct job, which require a restart in most cases, and also hardly can be managed by this plugin from inside jenkins, would need to run priori to it's execution. Better imho to rely on plugins.txt as in docker image.
from configuration-as-code-plugin.
My current thoughts on this feature:
We could implement a dedicated Configurator for a new plugins
RootElement and related new management component.
- relies on a map of plugin ID -> version
plugins:
git: 2.4
maven: 1.2
- checks PluginManager for installed plugins and compare with required version.
- react on version mismatch or plugin failure by replacing stapler
app
with an error page to block startup (or System.exit ?).
If we want to offer an equivalent for docker image's install-plugins.sh script we will need one additional step :
- react on missing plugins by triggering installation and restart jenkins.
But this would have to run after jenkins.updateCenter.sites
and jenkins.proxy
, have been configured, and also the yaml configuration would probably be invalid at parsing time as referenced plugins aren't installed yet (chicken and egg issue).
So we will need to have a special configuration file loaded before all others, to set jenkins.updateCenter.sites
, jenkins.proxy
, and required plugins, then (maybe after restart) parse other configuration files.
As jenkins.proxy
is configured on UI via PluginManager, I suggest we define a special role for a plugins.yaml
file to be loaded first and used to configure PluginManager (and only this guy) :
plugins: # alias for PluginManager
updateSites:
- "http://jenkins-uc.acme.com"
proxy:
name: "proxy.acme.com"
port: 8080
userName: foo
password: ${INJECT}
required:
git: 2.4
maven: 1.2
from configuration-as-code-plugin.
Right after we implemented the change that puts all other elements under a fake 'jenkins' root element, should this also be put as a child of this fake root element? So we have:
jenkins:
plugins: ...
mailer: ...
from configuration-as-code-plugin.
@ewelinawilkosz Super just what i thought! :)
I've started to do a bit of work on this...and i've got something working atleast (I can set proxy on the jenkins instance)...but im not sure im doing it the right way. I can correctly configure a proxy configuration
@Override
public PluginManager configure(Object config) throws Exception {
Map map = (Map) config;
Configurator<ProxyConfiguration> pc = Configurator.lookup(ProxyConfiguration.class);
ProxyConfiguration pcc = pc.configure(map.get("proxy"));
Field f = Jenkins.class.getDeclaredField("proxy");
f.set(Jenkins.getInstance(), pcc);
Jenkins.getInstance().save();
return null;
}
I'm a bit unsure here, first of all i started out with a root configurator named plugins
...and an attribute proxy
added in the describe method of type ProxyConfiguration
. It's databound so the configure method correcty returns an object we can play with.
What would be the best root element to start with? @ndeloof suggested PluginManager, but some of the stuff i need to set seems to belong to UpdateCenter (I.e sites).
from configuration-as-code-plugin.
I don't think we have any adequate class in jenkins model for this purpose : update sites for sample have no associated UI for configuration. So probably better to define a set of custom data classes that you'll then use to configure plugin manager and other related elements (proxy, etc)
from configuration-as-code-plugin.
@ndeloof Thanks for the input! I'll try that approach instead.
from configuration-as-code-plugin.
issue discussed at post-FOSDEM hackathon (https://docs.google.com/document/d/1IlVC9wqYsaa3aO2krYTu6P8olX6K5jZxG4zQwbKXRyc/edit9) with following conclusion:
- Implement “Light solver” based plugin installation scheme in CaC
- Introduce metadata in the update center to make the light solver better than the dumb algorithm
@ndeloof will land his existing code into the repository
User experience: What we’d like to do
- B: just list “git” and “blueocean” and maybe specify their versions, have the dependencies figured out automatically
- KK: provide immutability. Be able to bring bacak the same exact plugin versions a year later
Proposed scenario:
$ cat > Pluginsfile
plugin “git”, “2.3”
plugin “blueocean”, “1.3”
$ cac Pluginfile
(this resolves dependencies, etc, then creates Pluginfile.lock that lists exact versions)
$ git add Pluginfile.lock
(you commit this result to ensure immutability)
# Updating dependencies
$ cac -preferMinimalModification | -preferLatest Pluginfile
(this will update Pluginfile.lock with new dependencies)
$ git commit Pluginfile.lock
see issue #6 above for how to reload this new setting into Jenkins
Also that means we detach plugins from jenkins.yaml and put it in separate file
from configuration-as-code-plugin.
@ndeloof are you going to work on that one?
from configuration-as-code-plugin.
Yes, I'll work on a proposal next week
from configuration-as-code-plugin.
let's continue in #104
from configuration-as-code-plugin.
Related Issues (20)
- Snake YAML Missing function HOT 5
- `$StaplerConverterImpl` is invoked with unexpected arguments
- Nicer error page on configuration error
- CasC support DateParameter plugin?
- Reload existing configuration failure HOT 10
- Not able to configure pipeline jobs using the JCasC plugin
- No configurator for the following root elements services HOT 8
- Invalid configuration elements for type class jenkins.model.GlobalConfigurationCategory$Security : queueItemAuthenticator HOT 4
- JCasC - configure a hudson.security.SecurityRealm HOT 3
- Typo / Name Change in Configuration as Code for gitscm demo HOT 6
- warning popup about master migration HOT 2
- SSH private key credential is corrupted by export + import HOT 2
- Add JUnit5 Annotation support for Test Cases
- Missing information how to generate/create yaml file HOT 1
- JCASC not able export create yaml with "list view swithin nested view" HOT 1
- Configuration As Code Plugin compatible with Scriptler HOT 1
- Jenkins Configuration Reload issue - ERROR 401 Unauthorized
- java.lang.IllegalArgumentException: No hudson.tools.ToolInstaller implementation found for jdkInstaller on Jenkins 2.440.1
- decodeBase64 it not working in casc secrets HOT 1
- Nonnull dependency issue on startup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from configuration-as-code-plugin.