您的位置:首页 > 其它

Set up Project in BF

2010-12-07 21:28 155 查看
第一步:弄清楚Build Process;

在我们的项目中,基本的Build Brocess 如下:

(1)将source code 从版本控制所在的服务器拷贝到专门存放prodution build的文件服务器。每次build需要建立临时目录存放source code,build完成后需要将临时目录删除。

(2)将build的source code拷贝到build所在的机器,调用build脚本进行build;

(3)将build的output和log打包输出到文件服务器。

(4)删除服务器所在的临时目录,发送build completed note;

第二步: 准备Build的机器;

有些项目需要跨平台编译,需要在多个平台上编译,如redhat4~6,sles9,windows等,因此需要安装保证对应的操作系统版本。同时需要安装好build所需依赖的库。由于文件服务器需要登录才能访问,因此需要安装文件服务器访问的客服端,而这些build machine 需要和Build Forge 沟通,因此还需要安装Build Forge 的client.

再次还需要创建build的目录,用于存放build的source code 和output

准备好这些机器后,最好首先现在这些机器上手动build,已确定build所需的dependency 是否都已经安装完毕。

第三步:在Build Forge上创建Project.

在创建前需要弄清楚以下三个概念:

(1)Project:

(2)Lib

(3)Step

基本上说一个project 可以包含若干个lib 和多个step,而step中可以调用lib,lib又由不同的step组成。

Project 和lib的区别在于project 有selector 而lib没有。

搞清楚了以下几个概念,需要确定哪些步骤适合step,哪些步骤可以创建为lib.lib的好处在于:它就像一个函数,你可以传给他不同的参数和环境变量的值,在不同的平台上执行相同的代码,极大的保证的代码的可重用性。

同时,不同的平台之间有一定的差异,在确定process的时候首先需要确定平台在编译时候的共性和不同之处。项目中将平台分为两大类型:Linux 和windows.linux 不同操作系统之间有一定的差异,但差异不是很大。而windows和linux平台之间差异较大。因此项目中存在两个主要的lib linux_build_lib,win_build_lib;

在创建step和lib的时候,还需要建立相应的环境变量。选择对应的selector.

第四步:测试;

在运行build forge 的project的时候与之对应的是Job,job和project 的关系有点类似于instance 和class的关系。每次project运行都会有与之对应的job id.job name一般由 job tag 和job num构成。

由于在Build Forge上建立process涉及的细节较多,因此单独列出。在本小节阐述。

(1)建立project: 选择 Project--> Add project in Build Forge,一般需要设置的变量为 project name, access,enviroment, selector,最好设置个超时。tag是指你希望每次运行时候的job的name。

(2)给project 添加step. 点击project,进去new page后选择add step.

step通常需要设置:step name 和command line,有的时候可能需要你设置是绝对路径还是相对路径。 有的时候不同的step需要在不同的机器上执行,则需要选择seletor,如果该 step是个lib,需要在inline中选择所调用的step.

写command 的时候注意:最好不要在一个step里面有多个command,特别是有return code 的情况,如果步骤超过了三步以上,用脚本实现最好。

(3)创建lib

选择liberary--> add library ,大体步骤和设置project 差不多,除了不需要选择selector。不再详细阐述。

(4)添加环境变量

一个enviroment是由多个variable组成的,varibale即键值对,同时一个varble的值还可以由多个varible组合。

选择eviroment-->add enviroment 填写name 和acces即可,然后选择刚才创建的evn add varible.一般varible的那么全部由大写组成。

一些Tips:

(1)如果在一个command line 有多个command 连接 ,如build-linux.sh | tee /${OS_TYPE}.log,则每次返回的都是最后一个command的结果,因此会出现build fail掉而step仍然为pass 的情况。

解决此问题的方法有两个:

(1)在command前设置 set -o pipefail;

(2)在step 之后使用body { margin: 0pt; padding: 0pt; }td, div { font-family: Tahoma; font-size: 10pt; vertical-align: top; }body { margin: 0pt; padding: 0pt; overflow: hidden; }.transcript { background-color: rgb(210, 210, 210); }.messageBlock { margin-left: 4px; margin-bottom: 3px; }.message { margin-left: 100px; word-wrap: break-word; white-space: pre-wrap; }.messageCont { margin-left: 100px; word-wrap: break-word; white-space: pre-wrap; }.other { overflow: hidden; color: rgb(57, 87, 122); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.myself { overflow: hidden; color: rgb(218, 129, 3); font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont { font-size: 8px; text-align: right; color: rgb(57, 87, 122); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.myselfCont { font-size: 8px; text-align: right; color: rgb(218, 129, 3); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.system { margin-left: 4px; word-wrap: break-word; color: rgb(218, 129, 3); font-style: normal; font-weight: normal; white-space: pre-wrap; }.showTimestamp { padding-left: 8px; margin-right: 3px; float: right; color: rgb(153, 153, 153); font-style: normal; font-weight: normal; }.other1 { color: rgb(172, 32, 0); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont1 { font-size: 8px; text-align: right; color: rgb(172, 32, 0); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other2 { color: rgb(60, 159, 168); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont2 { font-size: 8px; text-align: right; color: rgb(60, 159, 168); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other3 { color: rgb(226, 86, 20); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont3 { font-size: 8px; text-align: right; color: rgb(226, 86, 20); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other4 { color: rgb(11, 106, 200); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont4 { font-size: 8px; text-align: right; color: rgb(11, 106, 200); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other5 { color: rgb(178, 50, 144); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont5 { font-size: 8px; text-align: right; color: rgb(178, 50, 144); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other6 { color: rgb(2, 231, 199); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont6 { font-size: 8px; text-align: right; color: rgb(2, 231, 199); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other7 { color: rgb(91, 50, 132); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont7 { font-size: 8px; text-align: right; color: rgb(91, 50, 132); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.highlight { background-color: rgb(190, 214, 248); }.datestamp { cursor: default; margin-bottom: 1px; background-color: rgb(192, 192, 192); width: 100%; float: left; text-align: right; color: rgb(255, 255, 255); font-weight: bold; font-style: italic; }#chatAlert { float: left; border-bottom: 1px solid rgb(232, 208, 145); padding: 6px; width: 100%; color: rgb(165, 117, 76); }#chatAlertImage { float: left; }#chatAlertText { float: left; margin-left: 6px; }#chatAlertClose { float: right; margin-right: 10px; padding-right: 6px; margin-top: 0px; }#chatAlertText a { color: rgb(165, 117, 76); }#chatAlertText a:hover { color: rgb(165, 117, 76); text-decoration: none; }.tsDisplay { display: block; }.dsDisplay { display: block; }

exit ${PIPESTATUS[0]}

(2)如果需要同时在build forge里面输出log 和存log 文件,可以用tee command;

(3)在linux平台上command里面的注释可以用#,而windows则不行,#会报错,可以使用rem

(4)window上远程拷贝可以使用xcopy

xcopy //**.com/directory/file name local_directory_on_build_ machine /v/q/y

(5)windows上输出屏幕和log 可以使用type command

(6)REG ADD "HKCU/Software/Microsoft/Command Processor" /V DisableUNCCheck /T REG_DWORD /F /D 1

这个command是用来解决windows上的UNC pathbody { margin: 0pt; padding: 0pt; }td, div { font-family: Tahoma; font-size: 10pt; vertical-align: top; }body { margin: 0pt; padding: 0pt; overflow: hidden; }.transcript { background-color: rgb(210, 210, 210); }.messageBlock { margin-left: 4px; margin-bottom: 3px; }.message { margin-left: 100px; word-wrap: break-word; white-space: pre-wrap; }.messageCont { margin-left: 100px; word-wrap: break-word; white-space: pre-wrap; }.other { overflow: hidden; color: rgb(57, 87, 122); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.myself { overflow: hidden; color: rgb(218, 129, 3); font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont { font-size: 8px; text-align: right; color: rgb(57, 87, 122); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.myselfCont { font-size: 8px; text-align: right; color: rgb(218, 129, 3); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.system { margin-left: 4px; word-wrap: break-word; color: rgb(218, 129, 3); font-style: normal; font-weight: normal; white-space: pre-wrap; }.showTimestamp { padding-left: 8px; margin-right: 3px; float: right; color: rgb(153, 153, 153); font-style: normal; font-weight: normal; }.other1 { color: rgb(172, 32, 0); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont1 { font-size: 8px; text-align: right; color: rgb(172, 32, 0); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other2 { color: rgb(60, 159, 168); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont2 { font-size: 8px; text-align: right; color: rgb(60, 159, 168); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other3 { color: rgb(226, 86, 20); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont3 { font-size: 8px; text-align: right; color: rgb(226, 86, 20); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other4 { color: rgb(11, 106, 200); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont4 { font-size: 8px; text-align: right; color: rgb(11, 106, 200); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other5 { color: rgb(178, 50, 144); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont5 { font-size: 8px; text-align: right; color: rgb(178, 50, 144); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other6 { color: rgb(2, 231, 199); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont6 { font-size: 8px; text-align: right; color: rgb(2, 231, 199); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.other7 { color: rgb(91, 50, 132); vertical-align: top; font-weight: bold; font-style: normal; float: left; width: 95px; }.otherCont7 { font-size: 8px; text-align: right; color: rgb(91, 50, 132); font-family: Arial,Lucida Grande; font-style: normal; vertical-align: top; font-weight: bold; float: left; width: 95px; }.highlight { background-color: rgb(190, 214, 248); }.datestamp { cursor: default; margin-bottom: 1px; background-color: rgb(192, 192, 192); width: 100%; float: left; text-align: right; color: rgb(255, 255, 255); font-weight: bold; font-style: italic; }#chatAlert { float: left; border-bottom: 1px solid rgb(232, 208, 145); padding: 6px; width: 100%; color: rgb(165, 117, 76); }#chatAlertImage { float: left; }#chatAlertText { float: left; margin-left: 6px; }#chatAlertClose { float: right; margin-right: 10px; padding-right: 6px; margin-top: 0px; }#chatAlertText a { color: rgb(165, 117, 76); }#chatAlertText a:hover { color: rgb(165, 117, 76); text-decoration: none; }.tsDisplay { display: block; }.dsDisplay { display: block; }

(7)rmdir /S /Q $BF_ROOT/%BF_PROJECTNAME%/

(8)sometimes, if you use perl liberay,then when you run the script from server to local build machine,it may miss some files,then you need to export to local:try command"export BLDPERLLIB=directory name"

(9)run command "perl -c /path/code.pl" to do a compile check and find any major coding issues with perl script;

(10) use chdir to locate a directory with perl,the right way to use it

if(chdir(directory name) ==0)

{

can not locate to it,you need to exit with a error code;

}

else

{

do some thing

}

(10)windows上用7z解压缩:

7z x $targetDirectory//$downloadFile -o$targetDirectory -o means where to put the unzip file

(11)windows 上删除某个文件使用

del /s/f/q $targetDirectory/$downloadFile

(12)windows上用7z压缩:

$cmd = "7z a -t7z ${compressFileName} -o$target $target/name";

(13)linux建立和解除文件的link:

unlink linkename: 解除

ln -s file_to_be_linked link_name: 建立

(14)Linux 创建多层目录

mkdir -p directoryname

eg. mkdir -p /test/test

(15)Buildforge 中的bset 和tset

.tset env "$vat=***"

如果有多个线程同时在不同的platfrom上跑,但是都使用了同一个变量,但这些值必须不同的话,那么不能使用.test。.test会对所有的都生效
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐