Description for simple CI installation

Add description with procedure for simple CI installation, it
allow to build ISO and execute BVT test on it.

Related-Bug: #1512680

Change-Id: I6763a1bd364b7eff259f2d9d96d3c97a54693b5b
This commit is contained in:
Artur Kaszuba 2015-11-03 12:28:13 +01:00
parent 0239665e48
commit 23857e2802
1 changed files with 213 additions and 0 deletions

View File

@ -152,6 +152,219 @@ The downside of the swarm slave plugin is that every time you reboot Jenkins
master instance, slaves are recreated and, therefore, lose all the labels
assigned to them via Jenkins WebUI.
Jenkins Jobs
------------
Our CI requires many jobs and configuration, it is not convenient to configure
everything with jenkins GUI. We use dedicated
`repository <https://github.com/fuel-infra/jenkins-jobs>`_ and
`JJB <http://docs.openstack.org/infra/jenkins-job-builder/>`_
to store and manage our jobs.
Install Jenkins Job Builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~
To begin work with jenkins job builder we need to install it and configure.
#. Install packages required to work with JJB
::
apt-get install -y git python-tox
# or
yum install git python-tox
#. Download git repository and install JJB
::
git clone https://github.com/fuel-infra/jenkins-jobs.git
cd jenkins-jobs
tox
#. Enable python environment, please replace <server> with server name, for
example fuel-ci
::
source .tox/<server>/bin/activate
#. Create file jenkins_jobs.ini with JJB configuration. It could be created
at any place, for this documentation we assume that it will be placed in
conf/ directory, inside local copy of jenkins-jobs repository.
::
[jenkins]
user=<JENKINS USER>
password=<JENKINS PASSWORD OR API-TOKEN>
url=https://<JENKINS URL>/
[job_builder]
ignore_cache=True
keep_descriptions=False
recursive=True
include_path=.:scripts
.. note:: <JENKINS_USER> is the user already defined in Jenkins with an
appropriate permissions set:
* Read - under the Global group of permissions
* Create, Delete, Configure and Read - under the Job group of permissions
Upload jobs to Jenkins
~~~~~~~~~~~~~~~~~~~~~~
When JJB is installed and configured you can upload jobs to jenkins master.
.. note:: We assume that you are in main directory of jenkins-jobs repository
and you have enabled python environment.
Upload all jobs configured for one specified server, for example upload of
fule-ci can be done in this way:
::
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/fuel-ci:common
Upload only one job
::
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/fuel-ci:common 8.0-community.all
Building ISO with Jenkins
-------------------------
Requirements
~~~~~~~~~~~~
For minimal environment we need 3 systems:
* Jenkins master
* Jenkins slave with enabled slave function for ISO building and deployment
testing. This can be done in different ways. For instance, you can create
hiera role for such server with the values provided below. Please keep in
mind that you have to explicitely set run_test and build_fuel_iso variables
to true, as ones are not enabled by default.
::
---
classes:
- '::fuel_project::jenkins::slave'
fuel_project::jenkins::slave::run_test: true
fuel_project::jenkins::slave::build_fuel_iso: true
.. note:: Every slave which will be used for ISO deployment testing, like
BVT, requires additional preparation.
Once puppet is applied, and slave is configured in Jenkins master, you need
to run the prepare_env job on it. Job will setup the python virtual
environment with fuel-devops installed (:doc:`../devops`).
If you build ISO newer than 6.1 there is no need to change default job
parameters. For older versions you need to run build with
update_devops_2_5_x option checked.
* Seed server - it is the server where you plan to store built ISO
Create Jenkins jobs
~~~~~~~~~~~~~~~~~~~
To build your own ISO you need to create job configurations for it, it requires
a few steps:
#. Create your own jobs repository, for start we will use fuel-ci jobs
::
cd jenkins-jobs/servers
cp -pr fuel-ci test-ci
#. To build and test ISO we will use files:
* servers/test-ci/8.0/community.all.yaml
* servers/test-ci/8.0/fuel_community_publish_iso.yaml
* servers/test-ci/8.0/fuel_community.centos.bvt_2.yaml
* servers/test-ci/8.0/fuel_community.ubuntu.bvt_2.yaml
#. In all files you need to make changes:
* Change email devops+alert@mirantis.com to your own
* If you don't need reporting jobs you should delete triggering of
fuel_community_build_reports in all jobs or disable reporting job
::
- job:
...
publishers:
...
- trigger-parameterized-builds:
...
- project: fuel_community_build_reports
* Update seed name server in file
servers/test-ci/8.0/fuel_community_publish_iso.yaml
::
- job:
...
publishers:
...
- trigger-parameterized-builds:
...
- project: 8.0.fuel_community.centos.bvt_2, 8.0.fuel_community.ubuntu.bvt_2
...
predefined-parameters: |
ISO_TORRENT=http://seed.fuel-infra.org/fuelweb-iso/fuel-community-$ISO_ID.iso.torrent
* Update seed name server in file
servers/test-ci/8.0/builders/publish_fuel_community_iso.sh
::
sed -i 's/seed-us1.fuel-infra.org/seed.test.local/g' servers/test-ci/8.0/builders/publish_fuel_community_iso.sh
sed -i 's/seed-cz1.fuel-infra.org/seed.test.local/g' servers/test-ci/8.0/builders/publish_fuel_community_iso.sh
#. Create jobs on jenkins master
.. note:: Please remember to:
* change current directory to the root directory of cloned jenkins-jobs repository
* enable python environment
* use correct jenkins_jobs.ini file (with correct jenkins master server)
::
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/test-ci:common 8.0-community.all
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/test-ci:common 8.0.publish_fuel_community_iso
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/test-ci:common 8.0.fuel_community.centos.bvt_2
jenkins-jobs --conf conf/jenkins_jobs.ini update servers/test-ci:common 8.0.fuel_community.ubuntu.bvt_2
Start ISO building
~~~~~~~~~~~~~~~~~~
When you finish setting jobs up on jenkins master you will see project with
name 8.0-community.all there, to start ISO build and test procedure you need
to run mentioned project.
Build and test procedure have 3 steps:
* ISO building (8.0-community.all)
* when ISO is successfully created it will be uploaded to the seed server
(by triggering 8.0.publish_fuel_community_iso)
* successful upload will start BVT test (8.0.fuel_community.centos.bvt_2 and
8.0.fuel_community.ubuntu.bvt_2)
Gerrit
------