Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins CI: Where and how store configuration files?

I am in process of moving configuration parameters out of Java application. I discover that the best approach is to extend your classpath and use .properties files (leave ZooKeeper alone for another requirement).

So my WAR file no longer have any hosts/IPs/URLs, users/passwords.

DevOps distribute configs manually across test, stage, stable installations.

Now time for Jenkins to run tests. But they fail as there are no required .propeties files in classpath.

How can I load this config files to Jenkins and how to make in available in test classpath?

maven-surefire-plugin allow extending classpath and passing system-properties.

So only question how to get separate directory in Jenkins hosting server and load files to this directory and create alias/placeholder/envvar per build job to refer to this path in build config.

This job can be done with SSH access, but I think that this is "wrong way". I expect that this can be done via Jenkins UI (any manager can upload file in WEB browser).

UPDATE I have no requirements for distributed slave/master builds but it whould nice to have solution that migrate configuration files to slaves automatically...

In this way sshing to host or ftp/scp - bad thing.

like image 428
gavenkoa Avatar asked Oct 07 '14 11:10

gavenkoa


People also ask

Where are Jenkins config files stored?

The working directory is stored in the directory {JENKINS_HOME}/workspace/ . The configuration for all jobs stored in the directory {JENKINS_HOME}/jobs/ . Each job folder contains: The job configuration file is {JENKINS_HOME}/jobs/{JOBNAME}/config.

How do I save Jenkins configuration?

Use the UI of the current system to install and configure the plugin. Click Apply >> Save to save the configuration. Use Manage Jenkins >> Configuration as Code >> View Configuration to view the JCasC file with the plugin configured. Click on Download Configuration to save the modified configuration file locally.

What is the location where all of the Jenkins configuration logs and builds are stored?

$JENKINS_HOME is where all Jenkins-based installations store configuration, build logs, and artifacts.

Where is configuration data stored?

Configuration data is stored in operating system environment variables.


1 Answers

I read most of Jenkins docs, ask at mail list and IRC. Yea - Jenkins community is silent. At docs I found link to Config File Provider Plugin, after that I visit http://builder.evil.com/jenkins/pluginManager/available page and look for config keyword.

There are a lot related plug-ins with various usefulness to my subject (most useless first):

  • https://wiki.jenkins-ci.org/display/JENKINS/Envfile+Plugin - This plugin enables you to set environment variables via a file.
  • https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin - Allows credentials to be bound to environment variables for use from miscellaneous build steps.
  • https://wiki.jenkins-ci.org/display/JENKINS/Environment+Script+Plugin - Allows you to run a script before each build that generates environment variables for it.
  • https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin - This plugin makes it possible to have an isolated environment for your jobs.
  • https://wiki.jenkins-ci.org/display/JENKINS/Copy+Data+To+Workspace+Plugin - Copies data to workspace directory for each project build.
  • https://wiki.jenkins-ci.org/display/JENKINS/Copy+To+Slave+Plugin - This plugin allows to copy a set of files, from a location somewhere on the master node, to jobs' workspaces. It also allows to copy files back from the workspaces of jobs located on a slave node to their workspaces on the master one.
  • https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin - Adds the ability to provide configuration files (i.e., settings.xml for maven, XML, groovy, custom files, etc.) loaded through the Jenkins UI which will be copied to the job's workspace.

Only last plug-in - Config File Provider Plugin allow editing configs via Jenkins WEB interface. And it have brother - Managed Script Plugin - for uploading/managing/editing custom scripts. No question now I use Config File Provider Plugin!

like image 128
gavenkoa Avatar answered Sep 20 '22 03:09

gavenkoa