Setting up environment requires >= 3 machines, namely master, repo, and slave. Denote their IP is 123.123.123.1, 123.123.123.2 and 123.123.123.3.
- Install Jenkins and its dependencies Java 7. First do:
sudo apt-get install openjdk-7-jre-headless
Next install Jenkins 2.32.3 from e.g.
wget https://pkg.jenkins.io/debian-stable/binary/jenkins_2.32.3_all.deb
sudo dpkg -i jenkins_2.32.3_all.deb
Note that newer Jenkins version like 2.60+ does not work after configuration of the enviroment and results in a HTTP 503 error.
After the Jenkins and started (should automatically), visit 123.123.123.1:8080 via your browser and setup your Jenkins. Install all the plugins recommended and create your administrator account.
- Clone the environment setup config and modify it:
git clone https://github.com/ros-infrastructure/buildfarm_deployment_config.git
Modidy master/common.yaml
. Configure the following values.
jenkins::slave::ui_user
:jenkins::slave::ui_pass
:jenkins::slave::masterurl
: The URL of the master,http://123.123.123.1:8080
here.master::ip
: The IP of the master,123.123.123.1
here.repo::ip
: The IP of the repo server,123.123.123.2
here.user::admin::name
: The admin username of Jenkins, e.g. we useadmin
here.user::admin::password_hash
: The password hash of the admin user. Find it from thepasswordHash
tag in/var/lib/jenkins/users/admin/config.xml
.ssh_keys
: The public keys with which you can access the master server.jenkins::private_ssh_key
: generate a private key and save it here. This key will be set to/var/lib/jenkins/.ssh/id_rsa
and remember to authorized its corresponding public key in repo server.
See https://github.com/ros-infrastructure/buildfarm_deployment/README.md for reference.
- Install required dependencies, by
sudo ./install_prerequisites.bash
- Do the configuration
sudo ./reconfigure.bash master
The last step with log Running puppet
might take some time. In case of debug, edit ./reconfigure.bash
and change -v
in the last line to -VV -d
, which means dumpping more verbose log with also debug info. Logs are dumpped into /var/log/puppet.log
.
- Install the missing swarm-client.
A
jenkins-slave
account will be created on your system. Checksudo ls -l /home/jenkins-slave/swarm-client-1.22-jar-with-dependencies.jar
. You will find that the file is of size 0. This is because its download link is broken. Re-download it by
wget -O /home/jenkins-slave/swarm-client-1.22-jar-with-dependencies.jar https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/1.22/swarm-client-1.22-jar-with-dependencies.jar
- Re-run the configuration after swarm-client is downloaded.
sudo ./reconfigure.bash master
If things go right, you will see the jenkin-slave running by sudo service jenkins-slave status
.
-
Log in admin to your Jenkins master server by browse
http://123.123.123.1:8080
. In "Manage Jenkins/Configure Global Security" config. Check "Enable security" and select "TCP port for JNLP agents" as "Random". See https://stackoverflow.com/questions/38969044/jenkins-kubernetes-jenkins-slave-node-is-offline for reference. -
If things go right, now in the Jenkins master page "Manage Jenkins/Manage Nodes", you can see the "master" computer and the "slave_on_master" computer. If it does not appear, check the following might give hint.
sudo service jenkins-slave status
sudo vim /var/log/jenkins-slave/jenkins-slave.log
- Clone the environment setup config and modify it:
git clone https://github.com/ros-infrastructure/buildfarm_deployment_config.git
Modidy repo/common.yaml
. Configure the following values.
jenkins::slave::ui_user
:jenkins::slave::ui_pass
:jenkins::slave::masterurl
: The URL of the master,http://123.123.123.1:8080
here.master::ip
: The IP of the master,123.123.123.1
here.ssh_keys
: The public keys with which you can access the repo server. Recall when setting the master server we generated aprivate_ssh_key
. Now put its corresponding public key here for the access tojenkins-slave
user.jenkins-slave::reprepro_updater_config
: Select the targeted architecturearchitectures
. For examples, since I only care about x64 systems, I set it toamd64
. The given example config uses'E5944336 0776D936'
as thesigning_keys
. The later reconfigure will createE5944336
key but I do not know where0776D936
key is from. So to signing work I change'E5944336 0776D936'
toE5944336
. Note that'
is also removed since there seems a bug that it cannot be handled correctly.
- Install required dependencies, by
sudo ./install_prerequisites.bash
- Do the configuration
sudo ./reconfigure.bash master
The last step with log Running puppet
might take some time. In case of debug, edit ./reconfigure.bash
and change -v
in the last line to -VV -d
, which means dumpping more verbose log with also debug info. Logs are dumpped into /var/log/puppet.log
.
- Install the missing swarm-client.
A
jenkins-slave
account will be created on your system. Checksudo ls -l /home/jenkins-slave/swarm-client-1.22-jar-with-dependencies.jar
. You will find that the file is of size 0. This is because its download link is broken. Re-download it by
wget -O /home/jenkins-slave/swarm-client-1.22-jar-with-dependencies.jar https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/1.22/swarm-client-1.22-jar-with-dependencies.jar
- Re-run the configuration after swarm-client is downloaded.
sudo ./reconfigure.bash master
If things go right, you will see the jenkin-slave running by sudo service jenkins-slave status
.
- If things go right, now in the Jenkins master page "Manage Jenkins/Manage Nodes", you can see the "master" computer and the "repo" computer.
ssh_host_key
See https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/environment.rst for reference. In summary you should install the following:
sudo apt update && sudo apt install python3 python3-all python3-pip
sudo pip3 install empy
sudo pip3 install jenkinsapi
sudo pip3 install rosdistro
sudo pip3 install ros_buildfarm
Save the Jenkins username and password in ~/.buildfarm/jenkins.ini
so that the configuration code can access your Jenkins. See https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/environment.rst#provide-credentials-for-jenkins-master for reference.
[http://jenkins-instance-url.example.com:8080]
username=admin
password=changeme
Checkout https://github.com/ros-infrastructure/ros_buildfarm_config/ and modify index.yaml
. See https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/basic_configuration.rst for reference. Basically you should set:
jenkins_url
to your Jenkins address e.g.http://123.123.123.1:8080
.- rodep-generator
- custom_rosdep_url
Upload your customized ros_build_config
somewhere online, e.g. push it to Github http://github.com/YOUR_FORK/ros_buildfarm_config
. Do not use local address e.g. file:///
or http://localhost/
, because jobs ran in docker can not resolve the local address.
See https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/deploy_configuration.rst#generate-the-administrative-jenkins-jobs for reference. Clone a ros_buildfarm
and run the generate_all_jobs.py
.
git clone https://github.com/ros-infrastructure/ros_buildfarm/
cd ros_buildfarm/scripts
generate_all_jobs.py https://raw.githubusercontent.com/YOUR_FORK/ros_buildfarm_config/master/index.yaml --commit
See https://github.com/ros-infrastructure/ros_buildfarm/blob/master/doc/deploy_configuration.rst#import-packages for reference. Visit to your Jenkins on browser, trigger the job import upstream
.
USE BACKFILL_ROS
-
These jobs require to run a system Groovy script generated. Since Groovy 2.0 disallows using classpath to import external libraries. We should manually download some Java imports. See ros-infrastructure/buildfarm_deployment#147 for reference. In my case I need to download
diffutils
andapache-xml-xerces.jar
into/var/lib/jenkins/plugins/groovy/WEB-INF/lib
. Before downloading you might want to dosu - jenkins
to make surejenkins
owns the libraries. Then expand/var/lib/jenkins/scriptApproval.xml
with the one mentioned in issue #147. -
Visit to your Jenkins on browser. Install plugin
Dashboard View
. Then trigger the jobKrel_reconfigure-jobs
. -
If something happens like
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod hudson.model.View createViewFromXML java.lang.String java.io.InputStream
I have approved
staticMethod hudson.model.View createViewFromXML java.lang.String java.io.InputStream
method hudson.model.ModifiableViewGroup addView hudson.model.View
another
hudson.model.View updateByXml javax.xml.transform.Source