Jenkins: how to backup projects without workspace - jenkins

I want to take a backup of all my projects, which is in the \jobs folder, but most of it are the workspaces which is also very big.

You can use the thinBackup plugin.
This plugin backup all the xml files of your Jenkins server.
They are a lot of options if you want to backup more stuff:

Related

How to specify the folder on remote machine for backup usinf thinBackup plugin of jenkins?

I want to take the backup of jenkins confuguration in case if I lode my machine. I am using the thinBackup plugin provided by jenkins. It has an option where I provide the path to folder where I want to take the backup.
Now the problem is I want to specify the folder on another machine, as it makes sense to have backup on different machine, how do I specifythe path to that folder? Do I have to specify as if
abc#12.34.567.890:path/to/folder?
I am new to jenkins so any help would be appreciated.
Thin backup performs just copies of jenkins configuration files in a specific folder for convenience. Is up to you to store it to scm or other machines, but it can be done with some simple script that upload your backup zip if exists

Can Jenkins be backup just with config and jobs?

I want to do an automatically backup of the JENKINS_HOME but due to file size I just want to copy the config.xml and /jobs.
Is it possible to restore Jenkins if needed with just those two things? How is the process to do it? Just replacing the config.xml and /jobs and restarting the service?
Thanks.
Consider using the Jenkins SCM Sync configuration plugin - it allows to back up all your Jenkins settings (including job configurations) to git or SVN. Also, version control means you'll have an easier time debugging problems caused by configuration changes or to revert to an older configuration.

TFS - Build and Release, configuration file provider

Is there any similar plugin like this
https://wiki.jenkins.io/display/JENKINS/Config+File+Provider+Plugin
in TFS Build & Release
I want to provide configuration.json file which is not included in git source.
Unfortunately, there is no such extension in TFS/VSTS Build & Release.
According to your tag tfs2013, seems you are working with XAML build.
Just like you need a workspace on your dev machine to develop your app, you must specify the workspace that the build agent uses to build and test your app. Then we get/pull source files from TFS server side. It's not able to achieve below similar features in TFS UI:
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.
As a workaround, you could try to put configuration.json files in a ftp server instead of git source and then use a PowerShell solution to down the files in build agent workspace. If create a PowerShell to over FTP you can have it called by the build template(customize workflow).

jenkins backup plugin or better approach to backup jenkins configurations

If I need to backup jenkins configurations, do you have good recommendations? I'm researching and found https://wiki.jenkins.io/display/JENKINS/Backup+Plugin but I want to be able to automate the whole process
The way I like to do it is as a git repo. Init the repo in the JENKINS_HOME directory. Add a .gitignore file to eliminate the workspace directory(s). Optionally, you can ignore the log and/or logs directories. The plugins directory can probably be rebuilt entirely and doesn't need to be backed up, but it might make sense to dump a directory listing of the plugins directory to a file, or better yet, hit this url and dump that content to a file before you commit changes:
http://jenkinsurl/pluginManager/api/json?depth=1&pretty=true.
You can also ignore the caches directory and the war directory.
Setup a cron job, or a job in Jenkins to commit the changes the git repo on a regular basis. Even put a Jenkinsfile in the root of JENKINS_HOME and use that as your pipeline job to backup itself.
You can use Gearman plugin as an alternative, it supports backup as well as failover in the evnt of an outage.

Jenkins userContent files

We have a Jenkins master-slave model. Each job that is being run on slaves require a certain amount of configuration files. These files must be copied from master to each slave before the build step. So far I have been able to accomplish this with the Config File Provider Plugin. The drawback of this plugin is that it doesn't support folders, I would like to be able to put the configuration files for slave1 in the folder slave1 and so on. Now I have a huge list of files in the dropdown menu when creating a job and asked to provide configuration files.
This plugin comes with something handy: the configuration files can be edited via the web interface.
On the other hand Jenkins provides a userContent folder on the master accessible via http://[jenkins-server]/userContent that resolves my need for folders, but I haven't found a way to edit these files from the provided web interface.
I must mention that the master is a remote machine and I don't want to connect to it everytime I need to modify a file there. Is there any way to edit the files in the userContent folder, or to organize the files uploaded to the Config File Plugin into folders?
Thanks!
If possible put all the configuration into your SCM system and allow Jenkins to fetch them when needed/as they change.
Then your configuration files are managed just like your source code. As a bonus you can add a new node easily and developers can access and use they configuration files to test their build.
Supporting evidence:
Martin Fowler
Andrew Binstock
Darryl Bowler
If you have environment specific config files you can either load all of the individual config files into into your SCM system (this becomes unmanageable if you have a lot). Alternatively you can still store them in your SCM system and then do some combination of scripting with Jenkins parameters to update them on the fly.

Resources