Jenkins configuration from script

332 views
Skip to first unread message

Tomasz Szandała

unread,
Nov 3, 2016, 6:42:29 AM11/3/16
to Jenkins Users
Greetings All,
I am working on new Jenkins usage model for my Team.
My idea is to:
1. Create new cloud instance
2. Configure it and install Jenkins using Ansible
3. Configure Jenkins using some kind of script
4. Create and configure few projcts - I have them in DSL scripts currently.

My problem is point nr 3.:
I need to:
a. Configure LDAP
b. Add nodes
c. Install needed plugins.

So far I've found script to add nodes, but don't know how to use it from command line...

Anyone knows where to look for guides about my problem?

Thank You in advance,
Tomek

Victor Martinez

unread,
Nov 3, 2016, 3:36:26 PM11/3/16
to Jenkins Users
Hi,

You can use

Https://wiki.jenkins-ci.org/display/JENKINS/Post-initialization+script and use jenkins internal api and its plugin with groovy

Cheers

Andrew Hammond

unread,
Feb 16, 2017, 6:44:03 PM2/16/17
to Jenkins Users
I'm doing something similar. My current "solution" is as follows:

1) Jenkins master is run in a docker container. The dockerfile includes a 

RUN /usr/local/bin/install-plugins.sh your plugins listed here

Currently I have only the following plugins:
blueocean (I know it's beta, but it make jenkins actually usable, so...)
digitalocean-plugin (master is in DO, and build agents are spun up there on demand)
docker-build-step (we want to create docker images and push them to dockerhub...)
github-oauth (we have an organization on gh: use that to determine who people are)
github-branch-source (automatically scan repos in that organization and detect Jenkinsfiles)

2) Absolutely minimal configuration in the Jenkins master. That means all builds are driven by the Jenkinsfile in the repo with the code.

I'm trying to get scm-sync-configuration plugin working now, but I'm realizing that maybe it's not even worth trying. I think I'll just go with snapshotting the filesystem.

A

Damien Coraboeuf

unread,
Feb 18, 2017, 12:52:41 PM2/18/17
to Jenkins Users
At my client (big scale), the Jenkins master is provisioned using Groovy script files in the /var/lib/jenkins/init.groovy.d directory. Any script in this directory is run at Jenkins startup.

It is then just a matter of calling the Jenkins Java API to provision everything you need (credentials, tools, plugin configurations, etc.). That's some work to do, but on the other hand, it is only code and you can test it automatically before going in production.

Andrew Hammond

unread,
Feb 20, 2017, 1:46:12 PM2/20/17
to jenkins...@googlegroups.com
That sounds great! Thanks for the pointer!!!

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/-23DQjJQBx4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/afa96bee-0eb0-4f61-a25d-4e411a3cdd80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages