Jenkins Summary

Quick installation on linux ami

yum update -y
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
yum install jenkins -y
service jenkins start
chkconfig jenkins on

optional add an apache proxy so you can surf using the port 80 instead of port 8080 that maybe is blocked from your corporare firewall

yum install httpd -y
chkconfig httpd on
nano /etc/httpd/conf.d/welcome.conf

add this lines
ProxyRequests Off
<Proxy *>
        Order deny,allow
        Allow from all
</Proxy>
ProxyPass         /  http://localhost:8080/
ProxyPassReverse  /  http://localhost:8080/

and restart the service
service httpd restart

change jenkins user before the first start

sed -i 's/JENKINS_USER="jenkins"/JENKINS_USER="ec2-user"/g' /etc/sysconfig/jenkins
chown ec2-user:ec2-user /var/lib/jenkins/
chown ec2-user:ec2-user /var/log/jenkins
chown ec2-user:ec2-user /var/cache/jenkins/

Script details info level

as you can read from this page http://jenkins-ci.361315.n4.nabble.com/How-to-make-a-shell-script-quieter-td4548377.html

Jenkins build steps call shell scripts with the option -x, this enables the tracing of the shell script.
use "set +x" in your shell script or at the beginning of the build step script to turn the tracing off again.
Normally the "noisiness" is very helpful to check if the build has done properly

when you run the the bash script, you can use this first line to decrease the noise

#!/bin/bash +x

Roles

To use these features you need to install the plugin https://wiki.jenkins-ci.org/display/JENKINS/Role+Strategy+Plugin

After enable the role access control from
roles2.png
and select the Role Based Strategy
roles1.png

if you click on Manage Jenkins a new option will be showed Manage and Assign Role

Following this permissions table

jenkins-roles.png
  • if you want assign an user the rights to use the project assign to restricted and reporting
  • if you want the user modify his view assign to enhanced and dqcronjob

The Pattern Cronjob.*$ include all the jobs belong to the Cronjob view.

Parameters

from a property file

it worked for me
http://howto.praqma.net/jenkins/jenkins-interactive-job and http://howto.praqma.net/jenkins/jenkins-interactive-job/format-of-property-file

parameter depends from another parameter

I found the basic info in this post http://stackoverflow.com/questions/18393671/how-to-get-a-parameter-depend-of-other-parameter-in-hudson-or-jenkins
but it is not so much clear so I try to write all the steps:

  1. you need to install the plugin UpdateSites Manager https://wiki.jenkins-ci.org/display/JENKINS/UpdateSites+Manager+plugin
  2. you need to configure the biouno repos the documentation to configure are in the link of the previous step the information to add are in this page http://biouno.org/jenkins-update-site.html
  3. now you can install the plugin uno-choice-plugin of the biouno company the instruction to use this plugin are in this link https://github.com/biouno/uno-choice-plugin/wiki/Uno-Choice-Cascade-Dynamic-Choice-Parameter

Reduce the console output

start the build with the

#!/bin/bash +x

this will Suppress execution trace like it is written here http://superuser.com/questions/806599/suppress-execution-trace-for-echo-command
it is good to hide command and maybe credentials but also to avoid to much messages in the output when your script is stable so you don't need too much info

Backup

Back up and restore from this page https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

All the settings, build logs, artifact archives are stored under the JENKINS_HOME directory. Simply archive this directory to make a back up. Similarly, restoring the data is just replacing the contents of the JENKINS_HOME directory from a back up.
Back ups can be taken without stopping the server, but when you restore, please do stop the server.

Plugins Backup

there are some plugins for backup

put the backups in s3

Claus Conrad solution

from this page http://www.clausconrad.com/blog/backup-jenkins-configuration-to-s3
this guy do the following:

  1. copy all the important configuration and data from the JENKINS_HOME in the working directory
  2. create a big zip file
  3. upload to s3 using the "S3 plugin"

not bad like solution but it is bit heavy under my point of view

Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License