cdfcb901ad
Change-Id: I307fb9bc8fde20da79117964a4a1e1b06b95cffb |
||
---|---|---|
hardware-configuration | ||
iso-updater | ||
jjb | ||
pics | ||
plugin-test-examples/plugin_test | ||
puppet-manifests | ||
.gitmodules | ||
.gitreview | ||
README.rst |
README.rst
Fuel Plugin CI
Overview
Components, concept
Jenkins and web server for logs installation
First you should install puppet master and run the manifests.
All nodes described in manifests/site.pp
file.
CI needs the following amount of nodes:
- one node for jenkins master
- one more for jenkins slave
- one for log publication.
These nodes should be described in manifests/site.pp
with necessary classes:
class { '::fuel_project::jenkins::slave':}
class { '::fuel_project::jenkins::master':}
class { '::fuel_project::web':}
Run install script
sudo puppet-manifests/bin/install_puppet_master.sh
on every
node.
Gerrit Integration overview
In general, the installation should meet the following requirements:
Anonymous users can read all projects.
All registered users can perform informational code review (+/-1) on any project.
Jenkins can perform verification (blocking or approving: +/-1).
All registered users can create changes.
Members of core group can perform full code review (blocking or approving: +/- 2) and submit changes to be merged.
Make sure you have gerrit account on review.openstack.org (see this for the reference):
ssh -p 29418 review.openstack.org "gerrit create-account \ --group 'Third-Party CI' \ --full-name 'Some CI Bot' \ --email ci-bot@third-party.org \ --ssh-key 'ssh-rsa AAAAB3Nz...zaUCse1P ci-bot@third-party.org' \ some-ci-bot
Jenkins gerrit plugin configuration
The settings look as follows:
It's main gerrit configuration window. You should add a gerrit server.
Vote configuration.
Log publication The result of job are artifacts - logs and packages. Logs should be published on special web servers, where it can be accessible via gerrit. The web server deploys with puppet class
fuel_project::web
.
Logs copy via ssh by job fuel-plugins.publish_logs
. You
should add new user with rsa key installed and necessary path accessible
for write (like /var/www/logs
).
The REPORTED_JOB_URL
variable is responsible for url of
logs in gerrit.
Jenkins plugins installation
We recommend to install these plugins for Jenkins. Some of them are necessary for CI and other is just useful and make your jenkins experience easier:
- AnsiColor
- Ant Plugin
- build timeout plugin
- conditional buildstep
- Copy Artifact Plugin
- Credentials Plugin
- CVS Plug-in
- description setter plugin
- Email Extension Plugin
- Environment Injector Plugin
- External Monitor Job Type Plugin
- Gerrit Trigger
- GIT client plugin
- GIT plugin
- Groovy
- Heavy Job Plugin
- HTML Publisher plugin
- Javadoc Plugin
- Job Configuration History Plugin
- JUnit Plugin
- LDAP Plugin
- Locale plugin
- Mailer Plugin
- MapDB API Plugin
- Matrix Authorization Strategy Plugin
- Matrix Project Plugin
- Maven Integration plugin
- Multijob plugin
- Multiple SCMs plugin
- OWASP Markup Formatter Plugin
- PAM Authentication plugin
- Parameterized Trigger plugin
- Publish Over SSH
- PWauth Security Realm
- Run Condition Plugin
- SCM API Plugin
- Script Security Plugin
- Self-Organizing Swarm Plug-in Modules
- Simple Theme Plugin
- SSH Agent Plugin
- SSH Credentials Plugin
- SSH Slaves plugin
- Subversion Plug-in
- Throttle Concurrent Builds Plug-in
- Timestamper
- Token Macro Plugin
- Translation Assistance plugin
- Windows Slaves Plugin
- Workflow: Step API
Jenkins jobs installation
Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML or JSON format and uses them to configure Jenkins.
To install JJB, run the following commands:
git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
cd jenkins-job-builder && sudo python setup.py install
Before running JJB you need to prepare a config file with the following info (fill it with your own values):
[jenkins]
user=jenkins
password=1234567890abcdef1234567890abcdef
url=https://jenkins.example.com
And update a JJB configuration using the file from the previous step:
jenkins-jobs --conf yourconf.ini update path_to_repo/jjb
You may find some examples in this repo. They're depersonalized copies of real jobs, so don’t install them without reworking. Please replace necessary paths and variables to make them work again.
Plugin test templates
Most of necessary functions can be found in fuel-qa framework.
All functional tests should be stored in plugin’s git repository in a special folder named plugin_test. Fuel-qa framework should be submodule in the plugin_test` folder. You can add submodule by this command:
git submodule add https://github.com/openstack/fuel-qa
<pic>
In the folder ./plugin-test-examples/plugin_test
you may
find two simple tests. The first one installs a test plugin, creates a
cluster and enables the plugin for this cluster. The second one deploys
a cluster with the plugin enabled.
There are two subfolders here: helpers
and
tests
. Helpers contains two files with important functions:
* prepare_test_plugin - installs the plugin to master node *
activate_plugin - activates the plugin * assign_net_provider - allows to
choose network type for cluster * deploy_cluster - deploys a cluster
The next folder includes tests. In the example provided with this repo there is only one important file named test_smoke_bvt.py. It describes a class TestPlugin and 2 tests mentioned earlier.
Hardware test examples
The main problem of hardware configuration is authorization. SSH does
not allow to enter a password in a script non interactively, so
expect
utility may be used to avoid the problem.
You should install the util on jenkins-slave first:
apt-get install expect
Here is an example of a script that uses expect for auth on a switch and shows its configuration:
spawn ssh "root@$switch_ip"
set timeout 500
expect "yes/no" {
send "yes\r"
expect "*?assword" { send "$switch_pass\r" }
} "*?assword" { send "$switch_pass\r" }
expect "# " { send "show run" }
expect "# " { send "exit\r" }
Fuel ISO updating
There is a script
fuel-plugin-ci/iso-updater/get_iso.sh
.
It should be added to cron and executed every 2-3 hours.
This script checks for a new community build of Fuel and if there is a new version available, it downloads such. You can run the script on a jenkins-slave node or any web server if you have many slave nodes. Here is how the script works:
- Check for the latest community iso. Check the
https://www.fuel-infra.org/release/status
url using thew3m
utility and chooses the right tab:the first tab is 8.0 now, so it needs the 2nd tab with Fuel 7.0.
Then it parses the tab and gets a Fuel release string.
Note
if new Fuel version is available, you should fix the script and change a tab number. Also output may change between linux distros and last cut field may change.
- Download torrent file from http://seed.fuel-infra.org/fuelweb-iso/ via
aria2
console torrent client. - Check for errors and delete folder if there is an error.
- Sync downloaded iso with a jenkins slave. You should have necessary users with rsa keys set.