GBS local full build Docker image

From Tizen Wiki
Jump to: navigation, search

Tizen Infra : GBS local full build by jenkins with Docker

Introduction

This jenkins job is designed for Tizen package building, image creation and build artifacts publishing by using repo and GBS as basis. It can be reconfigured to run periodically or be manually triggered whenever needed. With PUBLISH option enabled, build artifacts, including build reports, repos and images, will be synchronized to respective download servers. Before using this job, it is highly recommended that Creating a Tizen Image from Scratch , which is the manual equivalent of this job, is read and well understood.

Installation

  • Download docker file of jenkins
$ wget http://download.tizen.org/docker/jenkins-gbs-full-build/jenkins-gbs-full-build-0.2-docker-script.tar.gz

--2015-09-17 11:13:25--  http://download.tizen.org/docker/jenkins-gbs-full-build/jenkins-gbs-full-build-0.2-docker-script.tar.gz
Length: 876755859 (836M) [application/x-gzip]
Saving to: `jenkins-gbs-full-build-0.2-docker-script.tar.gz'

100%[==================================================================================>] 876,755,859 

2015-09-17 11:14:42 - `jenkins-gbs-full-build-0.2-docker-script.tar.gz' saved [876755859/876755859]
  • Decompress docker image of jenkins
$ tar -xvf jenkins-gbs-full-build-0.2-docker-script.tar.gz

clientjenkins-gbs-full-build/
clientjenkins-gbs-full-build/djenkins.sh
clientjenkins-gbs-full-build/jenkins-gbs-full-build-0.2-docker-image.tar.gz
clientjenkins-gbs-full-build/env/
clientjenkins-gbs-full-build/env/env.list
clientjenkins-gbs-full-build/README.md
clientjenkins-gbs-full-build/config.conf
clientjenkins-gbs-full-build/COPYING

config.conf : Metaconfig file of container
env : Environment variables of container
-docker-image.tar.gz : Docker image

  • Option: If you are using proxy in your enviroment. setting proxy in Docker
$ cd clientjenkins-gbs-full-build && vi env/env.list 

ftp_proxy=ftp://<proxy_ip>
http_proxy=http://<proxy_ip>
https_proxy=https://<proxy_ip> 
socks_proxy=socks://<proxy_ip>
  • Option: if you want to download complete tizen source code and repository, follow below step.
$ sudo mkdir -p /usr/tizen_data/
$ cd /usr/tizen_data/
$ sudo wget http://download.tizen.org/docker/jenkins-gbs-full-build/data/tizen_2.3_mobile.tar.gz

--2015-09-17 13:20:41--  http://download.tizen.org/docker/jenkins-gbs-full-build/data/tizen_2.3_mobile.tar.gz
Length: 8767906494 (8.2G) [application/x-bzip2]
Saving to: `tizen_2.3_mobile.tar.bz2'

100%[=====================================================================================>] 8,767,906,494 

2015-09-17 13:33:54  - `tizen_2.3_mobile.tar.bz2' saved [8767906494/8767906494]

$ sudo tar xvf tizen_2.3_mobile.tar.bz2

...
...
./tizen_2.3_mobile/repository/repos/noarch/setup-0.1-1.1.noarch.rpm
./tizen_2.3_mobile/repository/repos/noarch/model-build-features-0.5-1.1.noarch.rpm
./tizen_2.3_mobile/repository/_mobile_emulator

# if you don't change position directory(/usr/tizen_data) in tizen source code, don't change config file.
$ vi clientjenkins-gbs-full-build/config.conf 

...
### Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
export VOLUMES="/home/jenkins-gbs-full-build/var/lib/jenkins/:/var/lib/jenkins/
                /usr/tizen_data/:/var/lib/jenkins/tizen
               "
...


  • Load jenkins docker images
$ cd clientjenkins-gbs-full-build
$ sudo ./djenkins.sh load

IMAGES:tizendocker:443/jenkins-gbs-full-build:0.2
CONTAINER:jenkins-gbs-full-build
PORT:-p 8080:8080
ENV LIST:--env-file /home/g5kim/test/clientjenkins-gbs-full-build/env/env.list
VOLUMES:-v /etc/localtime:/etc/localtime:ro -v /home/jenkins-gbs-full-build/var/lib/jenkins/:/var/lib/jenkins/ -v /usr/tizen_data/:/var/lib/jenkins/tizen
HOST NAME:-h jenkins-gbs-full-build
PRIVILEGED:--privileged
AUTOSTART:--restart=always
LINKS:
VOLUMES-FROM:
ADD_HOST:
CAP_ADD:
Load an image from a tar archive
Load jenkins-gbs-full-build-0.2
  • Start jenkins docker image
$ sudo ./djenkins.sh start

IMAGES:tizendocker:443/jenkins-gbs-full-build:0.2
CONTAINER:jenkins-gbs-full-build
PORT:-p 8080:8080
ENV LIST:--env-file /home/g5kim/test/clientjenkins-gbs-full-build/env/env.list
VOLUMES:-v /etc/localtime:/etc/localtime:ro -v /home/jenkins-gbs-full-build/var/lib/jenkins/:/var/lib/jenkins/ -v /usr/tizen_data/:/var/lib/jenkins/tizen
HOST NAME:-h jenkins-gbs-full-build
PRIVILEGED:--privileged
AUTOSTART:--restart=always
LINKS:
VOLUMES-FROM:
ADD_HOST:
CAP_ADD:
Starting jenkins-gbs-full-build:
    docker run -d --name jenkins-gbs-full-build                   -h jenkins-gbs-full-build        \ 
                  --privileged                                                     -p 8080:8080                              --env-file /home/g5kim/test/clientjenkins-gbs-full-build/env/env.list                          
                  -v /etc/localtime:/etc/localtime:ro -v /home/jenkins-gbs-full-build/var/lib/jenkins/:/var/lib/jenkins/ -v /usr/tizen_data/:/var/lib/jenkins/tizen                                                      
                tizendocker:443/jenkins-gbs-full-build:0.2  jenkins-gbs-full-build
7be12bd3e20f        tizendocker:443/jenkins-gbs-full-build:0.2   "/bin/bash /srv/scri   3 weeks ago         Up Less than a second   0.0.0.0:8080->8080/tcp   jenkins-gbs-full-build

Usage

  • Connect to http://127.0.0.1:8080 → 'GBS-local-full-build' in jenkins job → Click 'Build with Parameters' → Set configuration and Build
  • Supported build options are shown below:
MANIFEST_ENABLE
    Source code download to use MANIFEST. After attach source docker image, If you modify some source code, this enable option occurs conflict

MANIFEST_URL
    This option specifies the manifest URL, which will be recognized by the repo command, for example, in tizen:scm/manifest, scm/manifest is the manifest path in remote tizen.org Gerrit, whereas tizen is the alias set in ~/.ssh/config, an example of ~/.ssh/config is shown below:

        Host tizen review.tizen.org
        Hostname review.tizen.org
        Port 29418
        User <username>
        #ProxyCommand connect -S <proxy>:<port> %h %p

MANIFEST_BRANCH
    This option specifies the manifest branch used for synchronizing code, this value will be passed to repo command directly.

MANIFEST_PROFILE
    This option specifies the profile used for building.

LOCAL_SOURCE
    This option specifies the local source code.

LOCAL_REPOS
    This option specifies the local repos from which packages are obtained during package building.

ARCH
    This option specifies the arch to be built, currently the valid values are i586 and armv7l.

REMOTE_REPOS (optional)
    This option specifies the remote repos from which packages are obtained during package building. Valid remote repos must contains tizen repo data, including buildata, images and repos in it

PARALEL_THREADS
    This option specifies the number of builders GBS runs in parallel. Valid value is non-negative integer.

EXCLUDE_PACKAGES
    This option specifies the packages that will be excluded during package building. This option also can be used to break dependency cycles. Multiple packages must be separated by comma(,)

BUILD_ARGS
    This option specifies more GBS build options, which will be passed to gbs build command. Multiple options are supported, different options must be seperated by space, For more information about gbs build options, refer to gbs build usage.

PUBLISH
    This option enables the publishing of build artifacts, including build reports, images and repos.

PUBLISH_URL
    This option specifies the URL address to publish build artifacts. The format of PUBLISH_URL must be the same as rsync format, which can be a local path or remote URL like: user@hostname:/path/to/publish_dir. 
  • If you want to build the modified source code
$ sudo clientjenkins-gbs-full-build/djenkins.sh attach

IMAGES:tizendocker:443/jenkins-gbs-full-build:0.2
CONTAINER:jenkins-gbs-full-build
PORT:-p 8080:8080
ENV LIST:--env-file /home/g5kim/test/clientjenkins-gbs-full-build/env/env.list
VOLUMES:-v /etc/localtime:/etc/localtime:ro -v /home/jenkins-gbs-full-build/var/lib/jenkins/:/var/lib/jenkins/ -v /usr/tizen_data/:/var/lib/jenkins/tizen
HOST NAME:-h jenkins-gbs-full-build
PRIVILEGED:--privileged
AUTOSTART:--restart=always
LINKS:
VOLUMES-FROM:
ADD_HOST:
CAP_ADD:
Attaching docker containers:
Script started, file is /dev/null

jenkins-gbs-full-build:/var/lib/jenkins # cd /var/lib/jenkins/tizen/tizen_2.3_mobile/source

# modify notification app
jenkins-gbs-full-build:/var/lib/jenkins/tizen/tizen_2.3_mobile/source # cd apps/home/notification
jenkins-gbs-full-build:/var/lib/jenkins/tizen/tizen_2.3_mobile/source/apps/home/notification # vi src/notification.c
jenkins-gbs-full-build:/var/lib/jenkins/tizen/tizen_2.3_mobile/source/apps/home/notification # git status
# Not currently on any branch.
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   src/notification.c
#
no changes added to commit (use "git add" and/or "git commit -a")
jenkins-gbs-full-build:/var/lib/jenkins/tizen/tizen_2.3_mobile/source/apps/home/notification # git add src/notification.c
jenkins-gbs-full-build:/var/lib/jenkins/tizen/tizen_2.3_mobile/source/apps/home/notification # git commit -m 'modify something'
[detached HEAD fa2c351] modify something
 1 file changed, 2 insertions(+), 1 deletion(-)

# Try build in jenkins 'GBS-local-full-build' job

  • follow below link for more information

https://wiki.tizen.org/wiki/GBS#GBS_Local_Full_Build

Troubleshoot

  • if you cannot open jenkins webUI, restart jenkins docker image
jenkins-gbs-full-build:/var/lib/jenkins # ls
jenkins-scripts  jobs  supervisord.log  supervisord.pid  tizen
jenkins-gbs-full-build:/var/lib/jenkins # exit
$ sudo ./djenkins stop
$ sudo ./djenkins rm
$ sudo ./djenkins start