++++++++++++++++++++++++++++++++++++++++++++++++
echo "构建地址:${BUILD_URL}" >> xxx.log
echo "SVN地址:${SVN_URL}" >> xxx.log
svn log -r${SVN_REVISION} >> xxx.log
OLD_IFS="$IFS"
IFS=" "
arr=(${SPECIFC_RSYNC_PATH})
IFS="$OLD_IFS"
for s in ${arr[@]}
do
echo "http://$domain/${s:2}" >> jira.log
done
++++++++++++++++++++++++++++++++++++++++++++++++
java -jar jenkins-cli.jar -s http://<jenkinshost>/ create-job <jobname> --username <admin name> --password <admin passwd> < config.xml
将要使用CLI命令有:
- create-job: Creates a new job by reading stdin as a configuration XML file.
- delete-job: Deletes a job
- update-job: Updates the job definition XML from stdin. The opposite of the get-job command
LIST="app browser campus cert common complaint db dl edu ent fashion finance focus food hb health hlj hn"
for d in $LIST
do
if [ 1 -eq 2 ]
then
cfgname=${d}config.xml
cp ./config.xml $cfgname
sed -i "s/auto/$d/g" $cfgname
java -jar jenkins-cli.jar -s http://10.10.4.3:8080/ create-job $d --username liang --password 123 < $cfgname
else
java -jar jenkins-cli.jar -s http://10.10.4.3:8080/ build $d -s --username liang --password 123,.
fi
done
jenkins默认会存放在用户主目录下的.jenkins文件夹中
如:Linux root用户:/root/.jenkins
注意:这是linux版本的。windows系统请自行更改。这个值在Jenkins运行时是不能更改的. 请先将Jenkins停止运行。
如果查看当前Jenkins目录:系统管理→系统设置→主目录→/root/.jenkins(注意:用户不同,路径也不同)
Jenkins储存所有的数据文件在这个目录下. 你可以通过以下几种方式更改:
- 使用你Web容器的管理工具设置JENKINS_HOME环境参数.
打开tomcat的bin目录,编辑catalina.sh文件。 在# OS specific support. $var _must_ be set to either true or false.上面添加:export JENKINS_HOME="" 在引号中填入你的路径。
- 在启动Web容器之前设置JENKINS_HOME环境变量.
用root用户登录 编辑profile文件:vi /etc/profile 在最后加入:export JENKINS_HOME=xxxx 保存,退出后执行:source /etc/profile 让配置生效
- (不推荐)更改Jenkins.war(或者在展开的Web容器)内的web.xml配置文件.
<!-- if specified, this value is used as the Hudson home directory --> <env-entry> <env-entry-name>HUDSON_HOME</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value></env-entry-value> </env-entry> <!-- 在<env-entry-value>节点中填入路径,windows系统建议使用/分隔路径 -->
好了,现在运行Jenkins看看效果吧。
windows用户可以请参考:http://www.cnblogs.com/itech/archive/2011/11/04/2236230.html