config.xml.ftl 7.8 KB
Newer Older
ibizdev's avatar
ibizdev committed
1 2 3 4
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#if pub.getPSDeployCenter()?? && sysrun.getRunMode()??>
sq3536's avatar
sq3536 committed
5
<#if pub.getPSDeployCenter().getCIType()?? && (pub.getPSDeployCenter().getCIType()=="JENKINS") >
ibizdev's avatar
ibizdev committed
6 7 8 9 10
<#if sysrun.getRunMode() == "STARTMSAPI">
<#assign depapi = sysrun.getPSDevSlnMSDepAPI()>
<#assign configId = depapi.getId()>
<#assign config = "api"+depapi.getName()>
<#assign depnode = sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()>
11
<#assign depplatform = sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatform()>
ibizdev's avatar
ibizdev committed
12 13 14 15 16
<#elseif sysrun.getRunMode() == "STARTMSAPP">
<#assign depapp = sysrun.getPSDevSlnMSDepApp()>
<#assign configId = depapp.getId()>
<#assign config = "app"+depapp.getName()>
<#assign depnode = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()>
17
<#assign depplatform = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform()>
ibizdev's avatar
ibizdev committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
</#if>
<#if sys.getPSSVNInstRepo().getGitBranch()?? && sys.getPSSVNInstRepo().getGitBranch()!="">
      <#assign branch=sys.getPSSVNInstRepo().getGitBranch()>
    <#else>
      <#assign branch='master'>
</#if>
<?xml version='1.1' encoding='UTF-8'?>
<project>
  <actions/>
  <description>${sys.codeName}</description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.model.StringParameterDefinition>
          <name>para1</name>
          <description></description>
          <defaultValue>para1</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>para2</name>
          <description></description>
          <defaultValue>para2</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>        
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
  </properties>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
      <command>
      BUILD_ID=DONTKILLME
      source /etc/profile
      rm -rf ${sys.codeName?lower_case}
	  git clone -b ${branch} $para2 ${sys.codeName?lower_case}/
      export NODE_OPTIONS=--max-old-space-size=4096
      cd ${sys.codeName?lower_case}/
<#if sysrun.getRunMode() == "STARTMSAPP">      
      mvn clean package -P${pub.getPSApplication().getPKGCodeName()?lower_case}
sq3536's avatar
sq3536 committed
65
<#if pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="SWARM") >      
ibizdev's avatar
ibizdev committed
66 67 68
      cd ${pub.getCodeName()?lower_case}-app/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}
      mvn -P${pub.getPSApplication().getPKGCodeName()?lower_case} docker:build
      mvn -P${pub.getPSApplication().getPKGCodeName()?lower_case} docker:push
69
      docker -H $para1 stack deploy --compose-file=src/main/docker/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.yaml ${depplatform.getName()} --with-registry-auth
sq3536's avatar
sq3536 committed
70 71
<#elseif  pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
<#else>
ibizdev's avatar
ibizdev committed
72 73 74 75 76 77 78
      echo &apos;echo &quot;$para1&quot;&apos; &gt; apppasswd.sh
      chmod -R 777 *
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;mkdir -p ${depnode.getWorkshopPath()}/${configId}&quot;
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r ${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.jar ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()}:${depnode.getWorkshopPath()}/${configId}
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;ps -ef | grep &apos;${depnode.getWorkshopPath()}/${configId}&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9  | grep -v grep | grep &apos;jar&apos; | cut -d&apos; &apos; -f1|xargs  --no-run-if-empty kill -9&quot;
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;source /etc/profile;source ~/.bash_profile; nohup java -jar -Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=128m ${depnode.getWorkshopPath()}/${configId}/${pub.getCodeName()?lower_case}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.jar &gt;&gt;${depnode.getWorkshopPath()}/${configId}/${sys.codeName?lower_case}_${config?lower_case}-`date --date=&apos;0 days ago&apos; +%Y-%m-%d`.log 2&gt;&amp;1 &amp;&quot;
</#if>
sq3536's avatar
sq3536 committed
79
</#if>
ibizdev's avatar
ibizdev committed
80 81
<#if sysrun.getRunMode() == "STARTMSAPI">      
      mvn clean package -P${pub.getPSSysServiceAPI().getCodeName()?lower_case}
sq3536's avatar
sq3536 committed
82
<#if pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="SWARM") >           
ibizdev's avatar
ibizdev committed
83 84 85
      cd ${pub.getCodeName()?lower_case}-provider/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}
      mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:build
      mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:push
86
      docker -H $para1 stack deploy --compose-file=src/main/docker/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.yaml ${depplatform.getName()} --with-registry-auth      
sq3536's avatar
sq3536 committed
87 88
<#elseif  pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
<#else>
ibizdev's avatar
ibizdev committed
89 90 91 92 93 94
      echo &apos;echo &quot;$para1&quot;&apos; &gt; apppasswd.sh
      chmod -R 777 *
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;mkdir -p ${depnode.getWorkshopPath()}/${configId}&quot;
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r ${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.jar ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()}:${depnode.getWorkshopPath()}/${configId}
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;ps -ef | grep &apos;${depnode.getWorkshopPath()}/${configId}&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9  | grep -v grep | grep &apos;jar&apos; | cut -d&apos; &apos; -f1|xargs  --no-run-if-empty kill -9&quot;
      setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;source /etc/profile;source ~/.bash_profile; nohup java -jar -Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=128m ${depnode.getWorkshopPath()}/${configId}/${pub.getCodeName()?lower_case}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.jar &gt;&gt;${depnode.getWorkshopPath()}/${configId}/${sys.codeName?lower_case}_${config?lower_case}-`date --date=&apos;0 days ago&apos; +%Y-%m-%d`.log 2&gt;&amp;1 &amp;&quot;
sq3536's avatar
sq3536 committed
95
</#if>
ibizdev's avatar
ibizdev committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
</#if>
      </command>
    </hudson.tasks.Shell>
  </builders>
  <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/>
</project>
</#if>
</#if>