The jobs are defined in here:
$JENKINS_HOME/jobs
For every project (item), there is a folder.
In every folder there is a config.xml file which hopefully should contain the entire project definition.
My assumption is that one should simply save the config.xml, and this is enough to recreate the project elsewhere.
I am worried because the Project definitions in Jenkins are not saved in bitbucket,
and we don’t have an automated way to export them from PROD and import them to a UAT instance.
One COULD tar the $JENKINS_HOME/jobs folder, but it’s very bulky.
[jobs]$ cd myproject/
[myproject]$ ls -ltra
drwxr-xr-x. 3 pippo pippogroup 4096 Jul 18 2016 modules
-rw-r--r--. 1 pippo pippogroup 6 Apr 25 2018 nextBuildNumber
lrwxrwxrwx. 1 pippo pippogroup 26 Apr 25 2018 lastSuccessful -> builds/lastSuccessfulBuild
lrwxrwxrwx. 1 pippo pippogroup 22 Apr 25 2018 lastStable -> builds/lastStableBuild
drwxr-xr-x. 5 pippo pippogroup 4096 Apr 25 2018 workspace
drwxr-xr-x. 24 pippo pippogroup 4096 Apr 25 2018 builds
-rw-r--r--. 1 pippo pippogroup 7257 Apr 25 2018 config.xml
drwxr-xr-x. 5 pippo pippogroup 4096 Apr 25 2018 .
drwxr-xr-x. 360 pippo pippogroup 20480 Mar 18 15:06 ..
especially the workspace is a PIG
So for the time being I will simply tar up all the config.xml and untar them in UAT:
cd $JENKINS_HOME/jobs
find . –maxdepth 2 –name config.xml | tar cvf /var/tmp/alljenkinsconfig.tar –T –
(maxdepth is important to avoid picking up files coming from the workspaces)
However we should really really IMHO push all those config.xml to bitbucket, regularly – ideally automatically whenever someone changes a config.xml:
git init
#set origin and remote
find . –maxdepth 2 –name config.xml –exec git add {} \;
git commit -m "blablabla"
git push
Incidentally, many project folders contain spaces, which makes it much trickier to write scripts to manipulate them.
I am not in favor of Capital Punishment, apart from cases when people create folders containing spaces.
Jenkins sucks anyway. Design is from Napoleonian Era, UI made by a freak, configuration freakishly XML based without fluent Administration Groovy API,
actually in the old times they were much better at designing stuff, think of the Tour Eiffel or the Pyramids and the Coliseum.
Nowadays any idiotic monkey can code freakish products like Maven or Jenkins and become a celebrity.
Wednesday, April 17, 2019
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment