Setup of Tizen Infrastructure with Docker

From Tizen Wiki
Jump to: navigation, search

Introduction

This document describes how to setup Tizen infrastructure using Docker images. Docker is a container-based software framework for automating deployment of applications. Containers are encapsulated, lightweight, and portable application modules. Docker is a platform for developers and sysadmins to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.

Tizen infrastructure consists of following software components.

  • Git/Gerrit
  • Jenkins
  • OBS Server
  • OBS Worker

The docker images for above components are already created and available in Tizen website http://cdn.download.tizen.org/docker.

Docker Installation

Docker-logo-loggedout.png

We recommend to use Ubuntu 14.04 OS as host. Docker requires a 64-bit installation regardless of your Ubuntu version. Please follow below instructions to install Docker on Ubuntu 14.04 OS.

  • Log into your Ubuntu installation as a user with sudo privileges. Verify that if wget is installed or not.
$ which wget
#If wget isn’t installed, install it after updating your manager:
$ sudo apt-get update
$ sudo apt-get install wget
  • Get the latest Docker package.

1. Check your OS version.

$ cat /etc/issue
Ubuntu 14.04..       ==> 2-1. General method to get Docker package.
Ubuntu 12.04..       ==> 2-2. In case of Ubuntu 12.04(LTS)(64-bit)

2-1. General method to get Docker package.

$ wget --no-check-certificate -qO- https://get.docker.com/gpg | sudo apt-key add -
$ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install -y lxc-docker-1.7.1  # This installs Docker version 1.7.1

2-2. In case of Ubuntu 12.04(LTS)(64-bit)

# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring
$ sudo reboot

$ apt-get update
$ apt-get install apt-transport-https

# Then, add the Docker repository key to your local keychain
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Add the Docker repository to your apt sources list, update and install the lxc-docker package.
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install -y lxc-docker-1.7.1
  • Add the connected user "${USER}" to the docker group. Change the user name to match your preferred user. You may have to logout and log back in for this to take effect.
$ sudo gpasswd -a ${USER} docker
$ exec su -l ${USER}
  • Verify whether Docker is installed correctly or not.
$ sudo docker run hello-world
#This command downloads a test image and runs it in a container.

To install Docker on any other operating system refer https://docs.docker.com/installation/

Git/Gerrit Docker image

Setup

Gerrit docker image version is 2.9.4.0.2 ( Gerrit version : 2.9.4 , Docker Image : 0.2). Following packages are bundled with Docker image
vim tar wget telnet supervisor sudo slapd ldap-utils phpldapadmin mysql-server php5-mysql php5-gd libapache2-mod-php5 
apache2 apache2-utils php5 php5-ldap phpldapadmin php5-mcrypt libapache2-mod-proxy-html git-core git-review openssh-server

wget packages:
wget http://ftp.drupal.org/files/projects/drupal-7.28.tar.gz
wget http://ftp.drupal.org/files/projects/simple_ldap-7.x-1.4.tar.gz
wget http://ftp.drupal.org/files/projects/ctools-7.x-1.5.tar.gz
wget http://ftp.drupal.org/files/projects/views-7.x-3.8.tar.gz
wget http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.tar.gz
wget http://gerrit-releases.storage.googleapis.com/gerrit-2.9.4.war
  • Download docker image and extract the contents
$ wget http://download.tizen.org/docker/gerrit/gerritdrupalldap-2.9.4.0.2-docker-script.tar.gz
$ tar -xvf gerritdrupalldap-2.9.4.0.2-docker-script.tar.gz
$ cd clientgerrit
$ ls 
config.conf  env                                             root
dgerrit.sh   gerritdrupalldap-2.9.1.0.2-docker-image.tar.gz

config.conf : Metaconfig file of container
env : Environment variables of container
-docker-image.tar.gz : Docker image
root : Specific configuration files to be applied on container

Configuration

  • Set up proxy and mysql configuration
$ vi env/env.list
Change your password #### LDAP CONFIG #### LDAP_ROOTPASS=opensuse LDAP_ORGANISATION=swplatform LDAP_DOMAIN=example.com #### MYSQL DB #### MYSQL_ROOT_PASSWORD=opensuse MYSQL_DATA_DIR_DEFAULT=/var/lib/mysql #### DRUPAL DB #### MYSQL_DRUPAL_DATABASE=drupal MYSQL_DRUPAL_USER=drupaluser MYSQL_DRUPAL_PASSWORD=drupalpassword #### GERRIT DB #### MYSQL_GERRIT_DATABASE=reviewdb MYSQL_GERRIT_USER=gerrit MYSQL_GERRIT_PASSWORD=gerritpassword #If you are use the proxy in your enviroment, pleaese add below line.
ftp_proxy=ftp://<proxy_ipaddress> http_proxy=http://<proxy_ipaddress> https_proxy=https://<proxy_ipaddress> socks_proxy=socks://<proxy_ipaddress>
  • Setup docker configuration
$ vi config.conf
Configuration a $(pwd)/config.conf of the dgerrit.sh Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container) Configuration a config.conf of the dgerrit.sh VOLUMES : "/home/gerritdrupalldap/" is a directory of your Host PC.and mounted a directory of the Container export PORTS="389 9999 29418" export VOLUMES="/home/gerritdrupalldap/var/lib/ldap/:/var/lib/ldap/ /home/gerritdrupalldap/etc/ldap/slapd.d/:/etc/ldap/slapd.d/ /home/gerritdrupalldap/var/lib/mysql:/var/lib/mysql/ /home/gerritdrupalldap/var/www/html/drupal/sites/default/:/var/www/html/drupal/sites/default/ /home/gerritdrupalldap/home/gerrit/gerrit/:/home/gerrit/gerrit/ $(pwd)/root/config/:/config/
  • Setup Gerrit configuration
The apach2_gerrit.conf file is copied to /etc/apache2/sites-available/gerrit.conf when container is started. (assigned port 9999)
$ vi $(pwd)/root/config/apache2_gerrit.conf
Listen 9999
<VirtualHost *:9999>
   DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName http://<HOST_IP>:9999/gerrit/ ProxyRequests Off ProxyVia Off ProxyPreserveHost On AllowEncodedSlashes On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /gerrit http://127.0.0.1:8081/gerrit nocanon </VirtualHost>
The gerrit.config file is copied to /home/gerrit/gerrit/etc/gerrit.config when contaianer is started.
$ vi $(pwd)/root/config/gerrit.config 
#Modify Gerrit config (Mandatory) [gerrit] basePath = git canonicalWebUrl = http://<HOST_IP>:9999/gerrit ...
  • Setting Account management configuration
Gerrit automatically assign first login as administrator. You can choice the Gerrit Auth type. HTTP , LDAP

- HTTP based authentication

$ vi $(pwd)/root/config/gerrit.config
...
[auth]
       type = HTTP
...
$ vi $(pwd)/root/config/apache2_gerrit.conf ... <Proxy *> Order deny,allow Allow from all </Proxy> <Location /gerrit/login> AuthType Basic AuthName "Gerrit Code Review" Require valid-user AuthUserFile /home/gerrit/gerrit/etc/passwd </Location> ProxyPass /gerrit http://127.0.0.1:8081/gerrit nocanon </VirtualHost>

- LDAP based authentication

$ vi $(pwd)/root/config/gerrit.config
...
[auth]
       type = LDAP
       ...
[ldap]
	server = ldap:// <HOST_IP>
...

Start/Stop Gerrit Server

  • Load the doker image from tar archive
$ ./dgerrit.sh load
  • List docker images
 $sudo docker images 
tizendocker:443/gerritdrupalldap         2.9.4.0.2
  • Start Docker container. This will start the Gerrit server. Modify the configuration as required before starting the container.
$sudo ./dgerrit.sh start 
$sudo docker ps
cccb2c273949        tizendocker:443/gerritdrupalldap:2.9.4.0.2            
"/bin/bash /srv/scri   8 days ago          Up 8 days           3306/tcp
     gerritdrupalldap
  • If you use a firewall on host OS, you have to allow the port numbers 80 389 9999 29418.
 $sudo ufw allow 80
 $sudo ufw allow 389
 $sudo ufw allow 9999 
 $sudo ufw allow 29418
  • Attach to Docker container
$sudo ./dgerrit.sh attach
  • Connect to Gerrit
 - Gerrit Web page : http://<HOST_IP>:9999/gerrit <br/>
 - Drupal Web page : http://<HOST_IP>:9999/drupal <br/>
 - PhpldapAdmin Web page : http://<HOST_IP>:9999/phpldapadmin <br/>
  • How to stop running container
This will stop the Gerrit Server
$sudo ./dgerrit.sh stop
  • How to clean-up Gerrit Docker image
$sudo ./dgerrit.sh stop
$sudo rm -rf <host_dir> #example /home/gerritdrupalldap
$sudo ./dgerrit.sh rm
$sudo ./dgerrit.sh start

Addtional

Gerrit automatically assign first login as administrator. You can choice the Gerrit Auth type. HTTP , LDAP

  • HTTP based authentication
#Set password to apache in Gerrit Container.
$ sudo ./dgerrit.sh attach
root@GerritDrupalLdap:/# htpasswd -cb /home/gerrit/gerrit/etc/passwd <gerrit_id> <gerrit_password>
root@GerritDrupalLdap:/# service apache2 restart

Test access by login to the Gerrit.

http://<HOST_IP>:9999/gerrit-> Login with your account (set in the previous step) -> Click your ID in top-left in gerrit page 
-> Click "Setting" -> Click "Groups" -> "Group name" must be "Administrator"
  • LDAP based authentication

connect to http://<HOST_IP>:9999/phpldapadmin/

Authenticate to server My LDAP Server
Login DN: cn=admin,dc=example,dc=com                            
Password: LDAP_ROOTPASS=opensuse of the env.list

Create your groups.(group,people)
Create new entry here -> Generic: Organisational Unit -> Organisational Unit : group
 -> Create Object -> Commit
Create new entry here -> Generic: Organisational Unit -> Organisational Unit : people
-> Create Object -> Commit
Create people in the group.
Select ou=group -> Create a child entry -> Default -> ObjectClasses: groupOfNames -> Proceed
   -> Add group information : RDN="cn(cn)" / cn : people / member : ou=people,dc=example,dc=com -> Create Object -> Commit
     
Add LDAP account.
Select ou=people -> Create a child entry -> Default -> ObjectClasses:inetOrgPerson 
-> Add user information : (RDN="User Name(uid)" and Input these entries: <cn>={new account},<sn>={new account},<displayName>={name},<Email>={email},<password>={password},<User Name>={name} 
-> Create Object -> Commit
- You have to wait at least one minute to update DB 

Test access by login to the Gerrit.

"http://<HOST_IP>:9999/gerrit" -> Login with your account (set in the previous step) -> Click your ID in top-left in gerrit page 
-> Click "Setting" -> Click "Groups" -> "Group name" must be "Administrator"

How to create certain gerrit project

1.Create gerrit project with empty commit
: ssh -p ${GERRIT_PORT} ${GERRIT_ID}@${GERRIT_IP} gerrit create-project $GERRIT_PROJECT_NAME --empty-commit
ex) 
- GERRIT_ID : example
- GERRIT_IP : 123.456.789.012
- GERRIT_PORT : port used by gerrit, default value is 29418
- GERRIT_PROJECT_NAME : tools/gbs
- REMOTE_REPO_NAME : docker_gerrit
==>$ ssh -p 29418 example@123.456.789.012 gerrit create-project tools/gbs --empty-commit
2.Push certain commit to gerrit project created above - This process is to commit your local git repository to gerrit project in your gerrit server. - Access ${HOST_IP}:9999/gerrit -> Projects -> Access -> Click "All-projects" -> Click "Edit" -> Check "V" to all "Force Push" - go to root of your local source git to commit - $ git clone ssh://${GERRIT_ID}@review.tizen.org:29418/tools/gbs - $ git remote add ${REMOTE_REPO_NAME} ssh://${GERRIT_ID}@${GERRIT_IP}:${GERRIT_PORT}/$GERRIT_PROJECT_NAME (ex. git remote add docker_gerrit ssh://example@$123.456.789.012:29418/tools/gbs ) - $ git push -f docker_gerrit HEAD:refs/heads/master - Click the (gitweb) button to check the result of push.

Jenkin docker image

Setup

Jenkins software is bundled as Docker image. The docker image contains openSUSE OS. Jenkins version is 1.580.3-1.2. Jenkin's docker image version is 0.4

Following packages are bundled in docker image.

vim tar wget telnet supervisor sudo mozilla-nss kvm libvirt libvirt-python qemu virt-manager qemu-linux-user jenkins-plugins jenkins-jobs jenkins-scripts redis gbs

http://mirrors.jenkins-ci.org/opensuse-stable/jenkins-1.580.3-1.2.noarch.rpm
http://download.tizen.org/tools/mic-appliance/15.01/mic-appliance.tar.bz2

apache2 php5 php5-mysql apache2-mod_php5 php5-gd php5-gettext php5-mbstring php5-pear php5-curl php5-suhosin apache2-mod_proxy_html

Download Docker image and extract the image contents

$ wget http://cdn.download.tizen.org/docker/jenkins/jenkins-1.580.3-1.2.0.4-docker-script.tar.gz
$ tar -xvf jenkins-1.580.3-1.2.0.4-docker-script.tar.gz
$ cd clientjenkins
$ ls 
COPYING    config.conf  env                                          root
README.md  djenkins.sh  jenkins-1.580.3-1.2.0.4-docker-image.tar.gz

clientjenkins/config.conf  : Metaconfig file of container
clientjenkins/env/env.list  : Environment variables of container
clientjenkins/jenkins-1.580.3-1.2.0.4-docker-image.tar.gz  : Docker image
clientjenkins/root/  : Specific configuration files to be applied on container

Configuration

  • Setting proxy in Docker
$ vi env/env.list 
#If you are using proxy in your enviroment, pleaese add below line.
ftp_proxy=ftp://<proxy_ip>
http_proxy=http://<proxy_ip>
https_proxy=https://<proxy_ip>
socks_proxy=socks://<proxy_ip>
  • Setting Docker configuration
$ vi config.conf
Configuration a config.conf of the djenkins.sh
VOLUMES : "/home/jenkins/" is a directory of your Host PC.and mounted a directory of the Container
/home/jenkins/var/lib/jenkins/:/var/lib/jenkins/
/home/jenkins/var/lib/redis/:/var/lib/redis/
/home/jenkins/srv/obs/:/srv/obs/ 
ADD_HOSTS: Add a custom host-to-IP mapping (host:ip) ADD_HOSTS="OBSServer:<OBSserver_ipaddress>"
  • Setting Jenkins configuration
$ vi $(pwd)/root/jobs/configuration
===== Jenkins job configuration file =====
${JENKINS_HOME}/jobs/configuration is used to keep all necessary parameters for
jenkins jobs. Set all incomplete keys, like gerrit and obs parameters, in this
file. Below is an example.

# OBS related parameters
OBS_URL=http://<obsserver_ipaddress>  ##Web url of OBS
OBS_API_URL=http://<obsserver_ipaddress>:81 ##Api url of OBS
OBS_API_USERNAME=Admin
OBS_API_PASSWD=xxxxxxxxx
# Gerrit related parameters
GERRIT_USERNAME=<gerrit_id>
GERRIT_HOSTNAME=<gerrit_ipaddress>  ## gerrit ip
GERRIT_SSHPORT=29418
GERRIT_SILENT_MODE=0
# Redis server
REDIS_HOST=<Redisserver_ipaddress>  ## Change this to localhost if Redis is installed on Jenkins server
REDIS_PORT=6379
# Git related parameters
GIT_CACHE_DIR=/var/lib/jenkins/git-cache
MAPPING_PROJECTS=
MAPPING_PRJ=scm/git-obs-mapping
REPOSYAML_PRJ=scm/meta/snapshot-repo-conf
# Image Testing parameters
TESTABLE_IMAGE_DOWNLOADABLES=bz2,bmap
TESTABLE_IMAGE_FILTER=*.bz2
#Host name of smtp server
SMTP_SERVER=
#The name displayed in mail for jenkins usage
NOREPLY_EMAIL_SENDER= 
#Mailinglist which jenkins will send SR notification to it
MAILINGLIST=
# Download server configuration
URL_PUBLIC_REPO_BASE=http://<downloadserver_ipaddress>:8888  ## download server ip
PATH_REPO_BASE=/srv/obs/repos/
PATH_LIVE_REPO_BASE=/srv/obs/repos/live
## Image sync configuration
IMG_SYNC_DEST_BASE=rsync://<jenkin_server_ipaddress>/_repos_RW_    ## jenkins server ip
## VM configuration
USE_VM=1
VM_IMAGE=/var/lib/jenkins/mic-appliance
VM_MEMORY=8192
VM_CPUS=8
SSH_CONNECTION=<jenkin_server_ipaddress> 

## Manifest content configuraion
GERRIT_FETCH_URL=ssh://<gerrit_ipaddress>                       ## gerrit server ip
GERRIT_REVIEW_URL=http://<gerrit_ipaddress>:9999/gerrit           ## gerrit server url 
## List of active projects ACTIVE_PROJECTS=Tizen:Common,Tizen:IVI,Tizen:Mobile,Tizen:TV,Tizen:Wearable # Dry-run mode for sync-obs SYNCOBS_DRYRUN=1
## Remote build logfile PATH_OBS_BUILD_BASE=rsync://<obsserver_ipaddress>/_build_R_ ## OBS server ip

Start/Stop Jenkin server

  • Load Jenkins Docker image on system
$sudo ./djenkins.sh load
  • List Docker images
$ sudo docker images
REPOSITORY                TAG                 IMAGE ID            CREATED            VIRTUAL SIZE
tizendocker:443/jenkins   1.580.3-1.2.0.4     abb8652606a6        1 hours ago        2.851 GB
  • Start Docker container
This will start the Jenkin server. Change the configuration described in below section before starting the container.
$ sudo ./djenkins.sh start 
  • If you use a firewall on host OS, you have to allow a port number.(8080 8888 6379 873)
 $sudo ufw allow 8080
 $sudo ufw allow 8888
 $sudo ufw allow 6379
 $sudo ufw allow 873
  • Attach to Docker container
$sudo ./djenkins.sh attach 
  • Connect to Jenkin
- Jenkins url: http://<HOST_IP>:8080.   <br/>
- Snapshot download url: http://<HOST_IP>:8888 <br/>
  • How to stop the docker container/Jenkins server
$sudo ./djenkins.sh stop
  • How to clean-up Jenkins server docker image
$ sudo ./djenkins.sh stop
$ sudo rm -rf <host_dir> # example /home/jenkins 
$ sudo ./djenkins.sh rm

Setup Gerrit access in container

  • Register Git username and email id in container
$sudo ./djenkins.sh attach
jenkins# sudo su -l -p jenkins
jenkins@Jenkins:~> git config --global user.name <user name>
jenkins@Jenkins:~> git config --global user.email <user email>
  • Create SSH keys
$sudo ./djenkins.sh attach
jenkins# sudo su -l -p jenkins
jenkins@Jenkins:~> ssh-keygen -t rsa
jenkins@Jenkins:~> cat .ssh/id_rsa.pub
#After pressing the Enter key at several prompts, an SSH key-pair will be created in /root/.ssh/id_rsa.pub .
#Upload SSH pubkey to Gerrit Click the links below to set up the Gerrit WebUI.
#Settings --> SSH Public Keys --> Add Key...
#Paste your SSH public key there, and then click 'Add'.
#Verify your SSH connection. You can verify your Gerrit connection by executing this command:
jenkins@Jenkins:~> ssh -p 29418 username@gerrit_ipaddress
#Make sure to add the server RSA key fingerprint to the known hosts of jenkins account if connect to gerrit server in the first time.
#If your settings are correct, you'll see the message below. If not, check SSH proxy and SSH public key on Gerrit.
 **** Welcome to Gerrit Code Review ****

# make config file
jenkins@Jenkins:~> vi .ssh/config
 Host <gerrit_ipaddress>
 Port 29418
 User <gerrit_username>
 IdentityFile ~/.ssh/id_rsa

Integrating Gerrit with Jenkins

Go to Jenkins website http://<HOST_IP>:8080 and follow the below steps to configure Gerrit in Jenkins.

 Click "Manage Jenkins" --> "Gerrit Trigger" --> "Add New Server"
 --> Enter Add New Server --> Check the Gerrit Server with Default Configurations --> Click OK
 Input Gerrit Server info: Hostname, Frontend URL, SSH port, Username, SSH Keyfile (local private SSH keyfile location), 
SSH Keyfile Password (if SSH keyfile contains  a password).
 Click Test Connection to make sure the connection to Gerrit works well.  Click the Save button at the bottom.
Click the 'Restart' button at the bottom.
 
 # gerrit server ip
 name : gerrit
 Hostname : <gerrit_ipaddress>
 Frontend URL : http://<gerrit_ipaddress>:9999/gerrit
 SSH Port : 29418
 Username : gerrit_username
 SSH Keyfile : /var/lib/jenkins/.ssh/id_rsa

Setup redis db with tizen snapshot configuration

Tizen repository and snapshot configuration is available in scm/meta/snapshot-repo-conf/repos.yaml. To populate this configuration in redis db, please follow the below instructions.

  • Clone the git project
$sudo ./djenkins.sh attach
jenkins# sudo su -l -p jenkins
jenkins@Jenkins:~> git clone ssh://<gerrit_username>@review.tizen.org:29418/scm/meta/snapshot-repo-conf
jenkins@Jenkins:~> cd snapshot-repo-conf
jenkins@Jenkins:~/snapshot-repo-conf> ssh -p 29418 <gerrit_username>@<gerrit_ipaddress> gerrit create-project scm/meta/snapshot-repo-conf --empty-commit
jenkins@Jenkins:~/snapshot-repo-conf> git remote add docker_gerrit ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf
jenkins@Jenkins:~/snapshot-repo-conf> git remote -v
                                                           docker_gerrit	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (fetch)
                                                           docker_gerrit	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (push)
                                                           origin	ssh://<gerrit_username>@review.tizen.org:29418/scm/meta/snapshot-repo-conf (fetch)
                                                           origin	ssh://<gerrit_username>@review.tizen.org:29418/scm/meta/snapshot-repo-conf (push)
jenkins@Jenkins:~/snapshot-repo-conf> git push -f docker_gerrit HEAD:refs/heads/master
                                                           error: failed to push some refs to 'ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf'
                                                           solution :  Access ${HOST_IP}:9999/gerrit -> Projects -> Access -> Click "All-projects" -> Click "Edit" -> Check "V" to all "Force Push" by Administrators
                                                                           => Click "Save Changes"
jenkins@Jenkins:~/snapshot-repo-conf> git push -f docker_gerrit HEAD:refs/heads/master

jenkins@Jenkins:~/snapshot-repo-conf> git remote remove origin
jenkins@Jenkins:~/snapshot-repo-conf> git remote -v
                                                            docker_gerrit	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (fetch)
                                                            docker_gerrit	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (push)
jenkins@Jenkins:~/snapshot-repo-conf> git remote rename docker_gerrit origin
jenkins@Jenkins:~/snapshot-repo-conf> git remote -v
                                                           origin	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (fetch)
                                                           origin	ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf (push)
jenkins@Jenkins:~/snapshot-repo-conf> gbs submit -m 'populate snapshot config in redis db'
                                                           error: failed to push some refs to 'ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf'
                                                           solution : - Access ${HOST_IP}:9999/gerrit -> Projects -> Access -> Click "All-projects" -> Click "Edit"
                                                           => Go to the section of "Reference:refs/tags/*" 
                                                           => select "Forge Author Identity" at scroll lists in the bottom -> Group Name : Administrators -> Click "Add"
                                                           => select "Forge Committer Identity" at scroll lists in the bottom -> Group Name : Administrators -> Click "Add"
                                                           => Click "Save Changes"
jenkins@Jenkins:~/snapshot-repo-conf> gbs submit -m 'populate snapshot config in redis db'

This will trigger jenkin's job load-repo-conf, which will download the repos.yaml and persists the configuration in redis db.
If job is not a build, please unchecked the "Restrict where this project can be run" of the load-repo-conf job and other jobs

Overview of git-obs-mapping.xml

$sudo ./djenkins.sh attach
jenkins# sudo su -l -p jenkins
jenkins@Jenkins:~> git clone ssh://<gerrit_username>@review.tizen.org:29418/scm/git-obs-mapping
jenkins@Jenkins:~> cd git-obs-mapping
jenkins@Jenkins:~/git-obs-mapping> ssh -p 29418 <gerrit_username>@<gerrit_ipaddress> gerrit create-project scm/git-obs-mapping --empty-commit
jenkins@Jenkins:~/git-obs-mapping> git remote add docker_gerrit ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/git-obs-mapping
jenkins@Jenkins:~/git-obs-mapping> git push -f docker_gerrit HEAD:refs/heads/master
jenkins@Jenkins:~/git-obs-mapping> git remote remove origin
jenkins@Jenkins:~/git-obs-mapping> git remote rename docker_gerrit origin
jenkins@Jenkins:~/git-obs-mapping> ls
                                                       README	git-obs-mapping.xml

git-obs-mapping.xml contains mappings between git projects and obs projects. Jenkins job will sync the git project changes to corresponding obs target project. Xml configuration file contains two parts default section for overall configuration and project specific configuration. Jenkins will read this file and determine the corresponding OBS project according to the following rules:
Example xml configuration
Git-obs-mapping.png
1. Search whether individual project configuration exists.

1.1 One OBS target project must contain two attributes at least, OBS_project means the final target OBS project, OBS_staging_project means the staging build project. Jenkins will sync gerrit project to OBS_staging_project directly, then create one OBS SR to request to merge to OBS_project according to whether this change modified changes file and attached one tag. As the example shows, the master branch of /pkgs/m/mic maps to Tizen:Main project and uses Tizen:Main:build as the staging project.

1.2 One branch could be mapped to multiply OBS project. The 4.4.7 branch of /pkgs/g/gcc maps to two OBS project Tizen:Main and Tools:dev.

1.3 If packaging directory contains multiply specfiles, use attribute OBS_package to specify the specfile name, like pkgs/g/gcc will use gcc-4.4.7.spec when submitting to Tools:dev.

1.4 When attribute submission equals N, it will block Jenkins sync this project or branch. As example shows, the whole project git-obs-mapping and the master branch of /pkgs/g/gcc are blocked. Default value of submission is "Y".

2. If project specific configuration doesn't exist and submission attribute is 'Y', check whether default section contains mapping setting for this branch.

2.1 Search configuration from leaf to root path. Using /pkgs/a/abc project as example, system will search path configuration follow this priority /pkg/a/ -> /pkg/ -> / .

2.2 The attribute submission="N" in patch configuation also can block all project under this path, like all projects under /internal/ are blocked as example shows.

3. Other branches will be ignored.

Short description of the jobs | detail

Triggered by Gerrit Event plugin
Triggered by obs-event-plugin
Triggered by upstream project
Using by jenkins-snapdiff project

OBS server docker image

Setup

The Open Build Service (OBS) is a generic system to build and distribute packages from sources in an automatic, consistent and reproducible way. It makes it possible to release software for a wide range of operating systems and hardware architectures. OBS docker image version is 2.4.0.7. OBS version is 2.4 and docker image version is 0.7

The following packages are bundled in docker image

vim tar wget telnet supervisor sudo
obs-server obs-signd obs-utils obs-api git-buildpackage obs-service-gbs obs-service-git-buildpackage
obs-source_service qemu-linux-user build-initvm-x86_64 build-initvm-i586 obs-event-plugin
apache2 apache2-mod_xforward rubygem-passenger-apache2 memcached
php5 php5-gd php5-gettext php5-mbstring php5-mysql
php5-pear php5-suhosin apache2-mod_php5 php5-bcmath
php5-bz2 php5-calendar php5-curl php5-ftp php5-gmp
php5-imap php5-ldap php5-mcrypt php5-odbc php5-openssl
php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp
php5-soap php5-sockets php5-sysvsem php5-wddx php5-xmlrpc
php5-xsl php5-exif php5-fastcgi php5-sysvmsg php5-sysvshm
npt iputils perl-GD libcurl4-7.42.1 librpm-tizen
  • Download the obs docker image and extract the image contents
$ wget http://cdn.download.tizen.org/docker/obsserver/obsserver_2.4-2.4.0.7-docker-script.tar.gz
$ tar -xvf obsserver_2.4-2.4.0.7-docker-script.tar.gz
$ cd clientobsserver 
$ ls
config.conf  dobsserver.sh  env  obsserver_2.4-2.4.0.7-docker-image.tar.gz  root

config.conf : Metaconfig file of container
env : Environment variables of container
-docker-image.tar.gz : Docker image
root : Specific configuration files to be applied on container

Configuration

  • Setup proxy configuration
$ vi env/env.list
#If you are using the proxy in your enviroment, pleaese add below line.
ftp_proxy=ftp://<proxy_ipaddress>
http_proxy=http://<proxy_ipaddress>
https_proxy=https://<proxy_ipaddress>
socks_proxy=socks://<proxy_ipaddress>
  • Setup Docker configuration
$ vi config.conf
# Configuration of the dobsserver.sh
# You can change the hostname. Do not change others.
export HOSTNAME= #hostname in container

#If you remove the Container, the changed values are deleted,
# the backup data must be managed volumes.
export VOLUMES="<host dir or filename>:<container dir or filename> 

Start/Stop OBS server

  • Load the obs docker image
$ sudo ./dobsserver.sh load 
  • List docker images
$ sudo docker images 
tizendocker:443/obsserver            2.4.0.7
  • Start the container
This will start the OBS server
$ sudo ./dobsserver.sh start 
If you use a firewall on host OS, you have to allow a port number.(80 81 82 443 444 873 5152 5252 5352)
$sudo ufw allow 80
$sudo ufw allow 81
$sudo ufw allow 82
$sudo ufw allow 443
$sudo ufw allow 444
$sudo ufw allow 873
$sudo ufw allow 5152
$sudo ufw allow 5252
$sudo ufw allow 5352
  • Attach to running container
$ sudo ./dobsserver.sh attach
  • How to connect OBS
web url : http://<HOST_IP>:80/ or http:// < ip > /
api url : http://<HOST_IP>:81/ or http:// < ip >:81 /
repos url : http://<HOST_IP>:82/ or http:// < ip >:82 /

# Admin password
Log in = id : Admin , pw : opensuse
  • How to clean-up OBS server docker image
$ sudo ./dobsserver.sh stop
$ sudo rm -rf /home/obsserver_2.4
$ sudo ./dobsserver.sh rm

Integrating Jenkins with OBS

#  Attach to a running container
$ sudo ./dobsserver.sh attach

> vi /usr/lib/obs/server/BSConfig.pm
# 1) Add lines below 
our $notification_plugin = "notify_jenkins";
our $jenkinsserver = "http://<Jenkins_Server_IP>:8080"; (ex. our $jenkinsserver = >     "http://123.456.789.012:8080";)
our $jenkinsjob = 'job/obs-event-dispatcher/buildWithParameters';
our $jenkinsnamespace = "OBS";
our @excl_patterns = ("project:Tizen:.* type:REPO_PUBLISH_STATE",
                        "type:BUILD_.*",
                        "type:SRCSRV_COMMIT",
                        "type:SRCSRV_VERSION_CHANGE");

our @incl_patterns = ("project:Tizen:.*",
                        "project:home:prerelease:.*");
# You must modify Jenkins_Server_IP as what you use.
# Optional : You can modify (add/ remove lists) "our @excl_patterns" & "our >     @incl_patterns"
#  : our @excl_patterns -> obs projects which is excluded from snapshot
#   :our @incl_patterns -> obs projects which is triggers jenkins to make snapshot

# 2) Add proxy IP
our $proxy = "Proxy_IP";
ex) our $proxy = "http://123.456.789.012/"; 

# 3) Add information about Jenkins server.
our $stageserver = 'rsync://Download_Server_IP/_live_RW_'; 
ex) our $stageserver = 'rsync://123.456.789.012/_live_RW_';


# exit a container
> exit

# restart a container
$ sudo ./dobsserver.sh stop

$ sudo ./dobsserver.sh start 

Setup Gerrit access

1. After getting a gerrit account, you need to create an ssh key, 
and add your ssh key to Gerrit to enable the connection to gerrit.
     
2. Please copy the link to your browser to activate the account.
Create SSH keys

$ sudo ./dobsserver.sh attach
$  cd /root
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Generating public/private rsa key pair.
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
3a:34:9c:35:7c:58:b1:81:9e:b9:64:3d:27:f7:3e:60 root@OBSServer
The key's randomart image is:
+--[ RSA 2048]----+
| .+. |
| ..o o |
| .=+o |
| . o*o+ o |
| =oS. = . |
| . o. E . |
| o . o |
| . o |
| . |
+-----------------+
# cat .ssh/id_rsa.pub

3. after pressing the Enter key at several prompts, an SSH key-pair will be created in /root/.ssh/id_rsa.pub
   Upload SSH pubkey to Gerrit Click the links below to set up the Gerrit WebUI.
   Settings --> SSH Public Keys --> Add Key...
   Paste your SSH public key there, and then click 'Add'.
4. Verify your SSH connection You can verify your Gerrit connection by executing this command:
   Make sure to add the server RSA key fingerprint to the known hosts of jenkins account
   if connect to gerrit server in the first time.
   If your settings are correct, you'll see the message below. If not, check SSH proxy
   and SSH public key on Gerrit.
   $ ssh -p 29418 gerrit_username@<gerrit_ipaddress>
   **** Welcome to Gerrit Code Review ****
5. $ vi .ssh/config
   Host <gerrit_ipaddress>
   Port 29418
   User <gerrit_username>
   IdentityFile ~/.ssh/id_rsa
6. Config Git for Gerrit Access After the above installation, which will include git, is complete, you can configure git.
   $ git config --global user.name "First_Name Last_Name"
   $ git config --global user.email "account@host"

OBS worker docker image

Setup

OBS worker docker image version is 2.4.0.3 ( OBS worker version : 2.4 Docker Image : 0.3) The OBS worker docker image has following packages bundled in it.

vim tar wget telnet supervisor sudo obs-worker
kvm libvirt libvirt-python qemu virt-manager qemu-linux-user 
build-initvm-x86_64 build-initvm-i586 psmisc
  • Download the Docker image and extract the image
$wget http://cdn.download.tizen.org/docker/obsworker/obsworker_2.4-2.4.0.3-docker-script.tar.gz
$ tar -xvf obsworker_2.4-2.4.0.3-docker-script.tar.gz
$ cd clientobsworker 
$ ls
config.conf  dobsworker.sh  env  obsworker_2.4-2.4.0.3-docker-image.tar.gz  root

config.conf : Metaconfig file of container
env : Environment variables of container
docker-image.tar.gz : Docker image
root : Specific configuration files to be applied on container

Configuration

  • Setup proxy configuration
$ vi env/env.list
#If you are using the proxy in your enviroment, pleaese add below line.
ftp_proxy=ftp://<proxy_ipaddress>
http_proxy=http://<proxy_ipaddress>
https_proxy=https://<proxy_ipaddress>
socks_proxy=socks://<proxy_ipaddress>
  • Docker configuration
$ vi config.conf 
### In the value of the OBS_WORKER_PORTBASE of the obs-server file must be increased by the number of OBS_WORKER_INSTANCES. # Use different ports for different containers ## ex) "hostport1 hostport2" or "hostport1:containerport1" or "exposeport1-exposeport2" export PORTS="60000-60003"
### Container name export CONTAINER="obsworker" # If you are running multiple containers in same system then name this as obsworker1 or obsworker2 etc
### Container host name export HOSTNAME="OBSWorker" # If you are running multiple containers in same system then name this as OBSWorker1 or OBSWorker2 etc
### Add a custom host-to-IP mapping (host:ip). export ADD_HOSTS="<obsserver hostname>:<ip>"
  • OBS worker configuration
$ vi $(pwd)/root/etc/sysconfig/obs-server
# Default setting : 4 instances are created, and 1 job (cpu) is assinged to each instance.
# You can change OBS worker setting (optimization based on your server environment)
# (refer to https://wiki.tizen.org/wiki/OBS_2.4_All-in-One_Server)
###Set Number of all instances which is used by worker
# OBS_WORKER_INSTANCES=(Max Port No. - Min Port No.+1)
# ex) if you use "export PORTS="60000-60007, then OBS_WORKER_INSTANCES=(60007-60000 +1) = 8
OBS_WORKER_INSTANCES="4"
# OBS_WORKER_JOBS : number of cpus which is used by each instance # Note : (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS ) must not exceed total number of host cpus. # ex) total number of host cpus = 32 core, and OBS_WORKER_INSTANCES=12 # if OBS_WORKER_JOBS=2, it's ok (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS =24, which is lower than 32) # if OBS_WORKER_JOBS=3, woker will not work. (OBS_WORKER_INSTANCES * OBS_WORKER_JOBS =36, which is higher than 32) OBS_WORKER_JOBS = 4
# important ( worker1,worker2 must be different port value.) # ex) worker1 server = "60000" then worker2 server = "60020"
OBS_WORKER_PORTBASE="60000"
# The hostname or the IP address of the OBS server OBS_SRC_SERVER="<OBSServer ip>:5352"
# The hostname or the IP address of the OBS server OBS_REPO_SERVERS="<OBSServer ip>:5252" ...
  • To run multiple containers/obs workers in same machine please follow the below steps
1) Copy the OBS worker docker image to another directory
2) Follow the instructions given in Setup section
3) Change the configuration

Start/Stop OBS worker

  • Load an image from a tar archive.
$ sudo ./dobsworker.sh load 
  • List docker images
$ sudo docker images 
tizendocker:443/obsworker            2.4.0.3
If you use a firewall on host OS, you have to allow a obsworker port number.
$sudo ufw allow proto tcp to any port 60000:60004
  • Start Docker container
This will start OBS worker
$ sudo ./dobsworker.sh start
  • Attach to running container
$ sudo ./dobsworker.sh attach
  • Debug OBS worker
If you want to see the build log.
$ sudo ./dobsworker.sh attach
# screen -r -d
      starting worker d41d8cd98f00b204e9800998ecf8427e build d41d8cd98f00b204e9800998ecf8427e
  1. To exit screen => ctrl+A and D
  2. To move to 0 screen => ctrl+A and 0
  • Cleanup docker image
$ sudo ./dobsworker.sh stop
$ sudo rm -rf <host_dir> # example /home/obsworker_2.4 
$ sudo ./dobsworker.sh rm

Example

I'll explain how to set the OBS Worker on multiple servers(A,B,C Server).
If hostname of OBS Server is "tizendocker" and IP is "10.0.0.1", add a ADD_HOSTS="tizendocker:10.0.0.1" in the config.conf of the OBS Worker.

  • OBS_Server: config.conf
export HOSTNAME="tizendocker"

If you want to increase a value of OBS_WORKER_INSTANCES. Please increase a PORTS value of config.conf.
OBS_WORKER_PORTBASE value must use a different PORT value.# important ( worker1,worker2 must be different PORT value.)

A Server

  • OBSWorker(default): config.conf
export CONTAINER="obsworker_2.4"
export PORTS="60000-60003" #"OBS_WORKER_PORTBASE-(OBS_WORKER_INSTANCES-1)"
export HOSTNAME="OBSWorker"
export ADD_HOSTS="tizendocker:10.0.0.1"
  • OBSWorker(default): root/etc/sysconfig/obs-server
...
OBS_WORKER_INSTANCES="4"
OBS_SRC_SERVER="10.0.0.1:5352"
OBS_REPO_SERVERS="10.0.0.1:5252"
OBS_WORKER_PORTBASE="60000"
...
$ sudo ./dobsworker.sh stop 
$ sudo ./dobsworker.sh rm 
$ sudo ./dobsworker.sh start

B Server

  • OBS_Worker0: config.conf
export CONTAINER="obsworker_2.4_0"
export PORTS="60010-60015" #"OBS_WORKER_PORTBASE-(OBS_WORKER_INSTANCES-1)"
export HOSTNAME="OBS_Worker_0"
export ADD_HOSTS="tizendocker:10.0.0.1"
  • OBS_Worker0: root/etc/sysconfig/obs-server
...
OBS_WORKER_INSTANCES="6"
OBS_SRC_SERVER="10.0.0.1:5352"
OBS_REPO_SERVERS="10.0.0.1:5252"
OBS_WORKER_PORTBASE="60010"
...
$ sudo ./dobsworker.sh stop 
$ sudo ./dobsworker.sh rm 
$ sudo ./dobsworker.sh start

C Server

  • OBS_Worker1: config.conf
export CONTAINER="obsworker_2.4_1"
export PORTS="60020-60029"  #"OBS_WORKER_PORTBASE-(OBS_WORKER_INSTANCES-1)"
export HOSTNAME="OBS_Worker_1"
export ADD_HOSTS="tizendocker:10.0.0.1"
  • OBS_Worker1:root/etc/sysconfig/obs-server
...
OBS_WORKER_INSTANCES="10"
OBS_SRC_SERVER="10.0.0.1:5352"
OBS_REPO_SERVERS="10.0.0.1:5252"
OBS_WORKER_PORTBASE="60020"
...
$ sudo ./dobsworker.sh stop 
$ sudo ./dobsworker.sh rm 
$ sudo ./dobsworker.sh start

Import OBS data

OBS data include a build data and a source rpm of Tizen 2.3 Project.
Please follow the below steps to import OBS data from http://download.tizen.org/docker/obsdata/

Download all files from http://download.tizen.org/docker/obsdata/tizen_2.3/tizen-2.3-mobile+wearable_20150311.3/
Run the script compress.sh, which will create one large compressed tar file

$./compress.sh
  • Remove the docker container and clean the OBS data
$ sudo ./dobsserver.sh stop
$ sudo ./dobsserver.sh rm
$ sudo rm -r /home/obsserver_2.4
  • Uncompress the tar file in your root directory.
# copy the file to root directory
$ sudo cp obsdata_tizen-2.3-mobile_20150311.3.tar.gz /  
$ cd /
$ sudo tar xzvpf obsdata_tizen-2.3-mobile_20150311.3.tar.gz 

The tar file contains following folders

/srv/obs/ 
/var/lib/mysql/ 
  • Start the docker container

This will start OBS server

$ sudo dobsserver.sh start

To import OBS data from source and binaries please refer https://wiki.tizen.org/wiki/OBS_binary/source_import

Troubleshooting

Known issue
The container doesn't work with Docker 1.8.1 version. Please use the Docker 1.7.1 version.

E: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

    $ sudo mkdir -p /usr/share/ca-certificates/extra/ 
    $ sudo cp [your_cert].crt /usr/share/ca-certificates/extra/  
    $ sudo dpkg-reconfigure ca-certificates
      Yes -> Check on "extra/[your_cert].crt"
    $ sudo update-ca-certificates
 

If you receive following error message while accessing Jenkins url

HTTP ERROR: 503
Problem accessing /. Reason:
    Service Unavailable
Powered by Jetty://

Solution :
$ ./djenkins.sh attach
# chown -R jenkins:jenkins /var/lib/jenkins/
# rcjenkins restart

If you get the below error while trying to connect OBSWorker to OBSServer, comment out "search" statement.

Application error
500

Solution : 
Comment out all "search" statements like as follows.
# vi /etc/resolv.conf
······
#search xyz.com
······

If you get the below error while trying to connect OBSWorker to OBSServer, check the firewall registration status

$ vi /srv/obs/logs/dispatcher.log
rpc timeout error

$ ufw status
-> There must not be 'DENY' item on ports which is used in OBS worker

example)
- OBS worker ports : 60000-60003
- ufw status results
      To                         Action      From
      --                         ------      ----
      60003:60020/tcp            DENY       Anywhere
--> You cannot use 60003 port for OBS worker

If you get the below error in 'create-snapshot' jenkins job, add your OBS project to redis DB

[Error] key obsrepomap:Tizen:2.3:mobile_20150311.3 don't exist in redis
Skipping, project isn't found in repo.yaml
No Files Found! Triggering Skipped.
Triggering projects: image-creator
No Files Found! Triggering Skipped.
Triggering projects: snapdiff-sync
No Files Found! Triggering Skipped.
Triggering projects: buildlogs

[Solution]
You have add your OBS project to scm/meta/snapshot-repo-conf/repos.yaml file.
example)
- Your OBS project : Tizen:2.3:mobile_20150311.3

$ git clone ssh://<gerrit_username>@<gerrit_ipaddress>:29418/scm/meta/snapshot-repo-conf
$ cd snapshot-repo-conf
$ vi repos.yaml
##Add these lines at the end of 'repos.yaml' file
    -   Name: Tizen-2.3-mobile_20150311.3
        Link: latest
        Release: "tizen-2.3-mobile_20150311.3"
        TopLevel: /srv/builds/temp/2.3-mobile_20150311.3
        Project: Tizen:2.3:mobile_20150311.3
        ProjectConfig: yes
        SnapshotDir: snapshots/2.3-mobile_20150311.3/common
        Targets:
            - Name: emulator
              Architectures:
                  - ia32
            - Name: target
              Architectures:
                  - armv7l

$git add repos.yaml
$git commit -m "Add TIzen:2.3:mobile_20150311.3 obs project"
$git push origin HEAD:refs/heads/master

If you failed to create image, check this.

[Error]
 File "/var/lib/jenkins/jobs/create-snapshot/workspace/jenkins-scripts/job_create_snapshot.py", line 221, in <module>
   sys.exit(main())
 File "/var/lib/jenkins/jobs/create-snapshot/workspace/jenkins-scripts/job_create_snapshot.py", line 191, in main
   repo_data = make_repo(project, backenddb, base_path, live_repo_base)
 File "/var/lib/jenkins/jobs/create-snapshot/workspace/jenkins-scripts/job_create_snapshot.py", line 145, in make_repo
   os.getenv('GERRIT_REVIEW_URL'))
 File "/var/lib/jenkins/jobs/create-snapshot/workspace/jenkins-scripts/common/repomaker.py", line 327, in gen_manifest_info
   package_vcs_tag =  manifest.get_package_vcs_tag(repo_primary)
 File "/var/lib/jenkins/jobs/create-snapshot/workspace/jenkins-scripts/common/manifest.py", line 51, in get_package_vcs_tag
   xml_file = gzip.open(primary_md)
 File "/usr/lib64/python2.7/gzip.py", line 34, in open
   return GzipFile(filename, mode, compresslevel)
 File "/usr/lib64/python2.7/gzip.py", line 89, in __init__
   fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
TypeError: coercing to Unicode: need string or buffer, NoneType found
Build step 'Execute shell' marked build as failure
Build step 'Groovy Postbuild' marked build as failure
Finished: FAILURE

[Solution] Check and fix the below index.
$ ./djenkins.sh attach $ vi /var/lib/jenkins/jenkins-scripts/common/repomaker.py
## check following code in "update_builddata" method. target["repos"] = [(rtype, rarch, os.path.join('repos', rpath.split('repos/')[2])) \ for rtype, rarch, rpath in dirs]
You have to modify 'image-configuration' package in your obs project
example) obs project = Tizen:2.3:mobile_20150311.3 1. wget http://<jenkins_server_ip>:8888/live/Tizen:/2.3:/mobile_20150311.3/emulator/src/image-configurations-xxx.src.rpm 2. unextract 'image-configurations-xxx.src.rpm' and then unextract 'image-configurations-9.tar.gz' 3. $ cd image-configurations-9 $ vi repos.yaml
## Modify 2.3-mobile part like below - Name: 2.3-mobile-target Url: http://<jenkins_server_ip>:8888/snapshots/2.3-mobile_20150311.3/common/@BUILD_ID@/repos/target/packages/ Options: --save --ssl_verify=no
- Name: 2.3-mobile-emulator Url: http://<jenkins_server_ip>:8888/snapshots/2.3-mobile_20150311.3/common/@BUILD_ID@/repos/emulator/packages/ Options: --save --ssl_verify=no
$ tar zcvf image-configurations-9.tar.gz image-configurations-9/
5. Access to obs server web ui -> click 'Projects' -> click 'Tizen:2.3:mobile_20150311.3' obs project -> search 'image-configurations' package and click it -> remove image-configurations-9.tar.gz from Source files -> Click 'Add file' -> Add newly created image-configurations-9.tar.gz file in the above -> OBS build starts automatically

Dockerfile

If you want to build an image from a Dockerfile, you can find a Dockerfile from review.tizen.org

git clone ssh://<review id>@review.tizen.org:29418/scm/services/docker-script
branch : gerrit , jenkins , obsserver-2.4 , obsworker-2.4

License

GNU license http://openbuildservice.org/help/manuals/obs-reference-guide/apb.html
Jenkins license https://jenkins-ci.org/mit-license
gerrit license https://gerrit.googlecode.com/svn/documentation/2.1/licenses.html
drupal license https://www.drupal.org/about

References

Docker user guide https://docs.docker.com/userguide/
Docker command line https://docs.docker.com/reference/commandline/cli/
Dockerfile reference https://docs.docker.com/reference/builder/
Jenkins installation and setup https://wiki.tizen.org/wiki/Jenkins_Installation_and_Setup
Jenkins/Gerrit/OBS intergration https://wiki.tizen.org/wiki/Jenkins/Gerrit/OBS_Interworking_Setup
OBS installation and setup https://wiki.tizen.org/wiki/OBS_Installation_and_Setup
openSUSE build service installation https://en.opensuse.org/openSUSE:Build_Service_private_installation
Open Build Service command line tool (OSC) : https://en.opensuse.org/openSUSE:OSC
Gerrit documentation https://gerrit-documentation.storage.googleapis.com/Documentation/2.9.4/config-gerrit.html
Import OBS binary/source https://wiki.tizen.org/wiki/OBS_binary/source_import
GBS local full build with Jenkin's docker image https://wiki.tizen.org/wiki/GBS_local_full_build_Docker_image
TDC2014 Event's presentation : https://www.tizen.org/sites/default/files/event/j1_tdc15_tizen_platform_development_process_and_infrastructure.pdf