Jenkins使用备忘

设置 /data目录权限

chown -R hpc:hpc /data

配置 /etc/profile的JAVA环境变量

maven 多模块项目 PathIngnore插件非常有用

必须要安装的插件 git,publish over ssh

git 需要配置  Global Config user.name Value

Global Config user.email Value

git config user.name haibao

git config user.email [email protected]

JENKINS服务器可以配置工作目录:可以配置在/etc/profile  export JENKINS_HOME=/data/jenkins 或者配置在tomcat启动脚本里设置 JENKINS_HOME这个环境变量

JENKINS服务器上的maven的settings.xml里面配置私服的profile的id不要与项目pom.xml的profile相同(如JENKINS服务器上的maven settings.xml私服profile的id可以叫local-repositories)

JENKINS服务器上的maven可以配置本地仓库的地址比如/data/maven/repo

deploy.sh脚本里先要设置环境变量 ,或者直接source /etc/profile(前提/etc/profile已经配置好JAVA环境变量)

配置tomcat的时候jenkins的访问日志也可以放在

      <Host name="localhost" appBase="/home/haibao/web/jenkins" unpackWARs="true" 

                          autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">

                        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/data/logs/jenkins"

                           prefix="jenkins_access_log" suffix=".txt"

                           pattern="%h %l %u %t &quot;%r&quot; %s %b %{CLIENT_IP}i &quot;%{Referer}i&quot;  &quot;%{Cookie}i&quot;" 

                           resolveHosts="false"/>

      </Host>

      如果发现not found symbol 编译错误,快速的解决方案是,到JENKINS服务器上 work目录里某个job里,执行mvn clean install -Dmaven.test.skip=true,可能是依赖的项目没有安装

如果发现在执行JOB时候发现 ,ERROR: Exception when publishing, exception message [Permission denied],有可能是没有某个目录的权限

drwxr-xr-x 5 root root 4096 May 27 17:20 psq-module-member-service

可以到部署机器上看下 ls -l ,可以用root权限删掉这个目录,再尝试执行job

Starting the psq-module-member-service ....bin/start.sh: line 64: /data/logs/service-logs/psq-module-member-service/stdout.log: Permission denied

可能是用root用户只执行过相应操作,生成了一些文件,可以使用  sudo chown -R hpc:hpc /data解决

lsof -i:8081 查看某个端口号的对应进程的所有者用户及进程号信息

猜你喜欢

转载自jaychang.iteye.com/blog/2301382
今日推荐