提交 d5b19cd8 编写于 作者: ibiz_zyy's avatar ibiz_zyy

支持Git分支

上级 8cea991a
...@@ -3,70 +3,35 @@ TARGET=PSSYSTEM ...@@ -3,70 +3,35 @@ TARGET=PSSYSTEM
</#ibiztemplate> </#ibiztemplate>
<#if sysrun.getPSAppServer() ?? > <#if sysrun.getPSAppServer() ?? >
<#assign tomcatPath=sysrun.getPSAppServer().getAppFolder()?substring(0,(sysrun.getPSAppServer().getAppFolder()?length)-7)> <#assign tomcatPath=sysrun.getPSAppServer().getAppFolder()?substring(0,(sysrun.getPSAppServer().getAppFolder()?length)-7)>
<#if sys.getPSSVNInstRepo().getGitBranch()?? && sys.getPSSVNInstRepo().getGitBranch()!="">
<#assign branch=sys.getPSSVNInstRepo().getGitBranch()>
<#else>
<#assign branch='master'>
</#if>
<?xml version='1.1' encoding='UTF-8'?> <?xml version='1.1' encoding='UTF-8'?>
<project> <project>
<actions/> <actions/>
<description>${sys.getPubSystemId()}</description> <description>${sys.getPubSystemId()}</description>
<keepDependencies>false</keepDependencies> <keepDependencies>false</keepDependencies>
<#if sys.getPSSVNInstRepo()?? && sys.getPSSVNInstRepo().getSVNType() =="SVN"> <properties>
<scm class="hudson.scm.SubversionSCM" plugin="subversion@2.10.5"> <com.gitee.jenkins.connection.GiteeConnectionProperty plugin="gitee@1.1.3">
<locations> <giteeConnection></giteeConnection>
<hudson.scm.SubversionSCM_-ModuleLocation> </com.gitee.jenkins.connection.GiteeConnectionProperty>
<remote>${sys.getReadOnlyPSSVNInstRepo().getConnStr()}/${sys.getPSDevSlnCodeName()}/${sys.getTrunkSysName()}/${sys.getVCName()}</remote> </properties>
<credentialsId>${sys.getPubSystemId()}</credentialsId> <scm class="hudson.scm.NullSCM"/>
<local>pub</local> <canRoam>true</canRoam>
<depthOption>infinity</depthOption> <disabled>false</disabled>
<ignoreExternalsOption>false</ignoreExternalsOption> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<cancelProcessOnExternalsFail>false</cancelProcessOnExternalsFail> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
</hudson.scm.SubversionSCM_-ModuleLocation> <triggers/>
<hudson.scm.SubversionSCM_-ModuleLocation> <concurrentBuild>false</concurrentBuild>
<remote>${sys.getPSSVNInstRepo().getConnStr()}/${sys.getPSDevSlnCodeName()}/${sys.getTrunkSysName()}/${sys.getVCName()}</remote> <builders>
<credentialsId>${sys.getPubSystemId()}</credentialsId> <hudson.tasks.Shell>
<local>usr</local>
<depthOption>infinity</depthOption>
<ignoreExternalsOption>false</ignoreExternalsOption>
<cancelProcessOnExternalsFail>false</cancelProcessOnExternalsFail>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
<excludedRegions></excludedRegions>
<includedRegions></includedRegions>
<excludedUsers></excludedUsers>
<excludedRevprop></excludedRevprop>
<excludedCommitMessages></excludedCommitMessages>
<workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
<ignoreDirPropChanges>false</ignoreDirPropChanges>
<filterChangelog>false</filterChangelog>
<quietOperation>false</quietOperation>
</scm>
<#elseif sys.getPSSVNInstRepo().getSVNType()=="GIT">
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.8.0">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>${sys.getPSSVNInstRepo().getGitPath()}</url>
<credentialsId>dev_ibizsys</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
</#if>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command> <command>
source /etc/profile source /etc/profile
rm -rf ${pub.codeName}
git clone -b ${branch} ${sys.getPSSVNInstRepo().getGitPath()} ${pub.codeName}
cd ${pub.codeName}
echo &apos;echo &apos;${sysrun.getPSAppServer().getRemotePassword()} &gt; apppasswd.sh echo &apos;echo &apos;${sysrun.getPSAppServer().getRemotePassword()} &gt; apppasswd.sh
chmod -R 777 * chmod -R 777 *
sed -i &quot;s/\r//&quot; `find ./ -name &quot;*.sh&quot;` sed -i &quot;s/\r//&quot; `find ./ -name &quot;*.sh&quot;`
...@@ -79,16 +44,29 @@ mvn clean install ...@@ -79,16 +44,29 @@ mvn clean install
cd ./srv_${pub.codeName}/target/ cd ./srv_${pub.codeName}/target/
mv srv_${pub.codeName}-1.0.0.0 ${pub.codeName} mv srv_${pub.codeName}-1.0.0.0 ${pub.codeName}
zip -r ${pub.codeName}.zip ${pub.codeName} zip -r ${pub.codeName}.zip ${pub.codeName}
setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh appuser@172.16.102.17 &quot;rm -rf /app/apache-tomcat-8083/webapps/${pub.codeName}*&quot; setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${sysrun.getPSAppServer().getRemoteUserName()}@${sysrun.getPSAppServer().getRemoteAddress()} &quot;rm -rf ${tomcatPath}webapps/${pub.codeName}*&quot;
setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r ${pub.codeName}.zip appuser@172.16.102.17:/app/apache-tomcat-8083/webapps/ setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r ${pub.codeName}.zip ${sysrun.getPSAppServer().getRemoteUserName()}@${sysrun.getPSAppServer().getRemoteAddress()}:${tomcatPath}webapps/
setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh appuser@172.16.102.17 &quot;unzip /app/apache-tomcat-8083/webapps/${pub.codeName}.zip -d /app/apache-tomcat-8083/webapps/;/app/apache-tomcat-8083/bin/shutdown.sh;ps -ef | grep &apos;/app/apache-tomcat-8083/&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9 | grep &apos;/app/apache-tomcat-8083/&apos; | cut -d&apos; &apos; -f1|xargs --no-run-if-empty kill -9;/app/apache-tomcat-8083/bin/startup.sh&quot; setsid env SSH_ASKPASS=&apos;../../apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${sysrun.getPSAppServer().getRemoteUserName()}@${sysrun.getPSAppServer().getRemoteAddress()} &quot;unzip ${tomcatPath}webapps/${pub.codeName}.zip -d ${tomcatPath}webapps/;${tomcatPath}bin/shutdown.sh;ps -ef | grep &apos;${tomcatPath}&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9 | grep &apos;${tomcatPath}&apos; | cut -d&apos; &apos; -f1|xargs --no-run-if-empty kill -9;${tomcatPath}bin/startup.sh&quot;
</command> </command>
</hudson.tasks.Shell>
</hudson.tasks.Shell> </builders>
</builders> <publishers>
<publishers/> <hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup@0.34">
<patterns class="empty-list"/>
<deleteDirs>false</deleteDirs>
<skipWhenFailed>false</skipWhenFailed>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<cleanupMatrixParent>false</cleanupMatrixParent>
<externalDelete></externalDelete>
</hudson.plugins.ws__cleanup.WsCleanup>
</publishers>
<buildWrappers> <buildWrappers>
<com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/> <com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper/>
</buildWrappers> </buildWrappers>
</project> </project>
</#if> </#if>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册