提交 0a372ccd authored 作者: 杨文彬's avatar 杨文彬

Merge remote-tracking branch 'origin/master' into dev

......@@ -96,7 +96,7 @@ public class GeneratorDeployJobScript {
model.put("floatingIp", floatingIp);
model.put("deployJar", deployJar);
String result = FreeMarkerUtils.process("jenkinsJobCreate.ftl", model);
String result = FreeMarkerUtils.process("deploy\\jenkinsJobCreate.ftl", model);
FileUtils.appendNewLine(createJobFile, result);
String jobsDir = root_path_jenkins_full + "\\" + jenkinsJobName;
......@@ -107,12 +107,12 @@ public class GeneratorDeployJobScript {
BackendFrontEnum backendFrontType = BackendFrontEnum.getEnumByCode(grayVersionDataDTO.getBackendFrontType());
if (BackendFrontEnum.BACKEND.equals(backendFrontType)) {
String configFilePath = jobsDir + "\\config.xml";
String jobConfig = FreeMarkerUtils.process("jobConfigBackend.ftl", model);
String jobConfig = FreeMarkerUtils.process("deploy\\jobConfigBackend.ftl", model);
FileUtils.appendNewLine(configFilePath, jobConfig);
} else {
String configFilePath = jobsDir + "\\config.xml";
String jobConfig = FreeMarkerUtils.process("jobConfigFront.ftl", model);
String jobConfig = FreeMarkerUtils.process("deploy\\jobConfigFront.ftl", model);
FileUtils.appendNewLine(configFilePath, jobConfig);
}
......
......@@ -55,9 +55,7 @@ public class GeneratorGitJobScript {
for (DeployInfoDataDTO deployDataDTO : grayVersionDataDTOList) {
BackendFrontEnum backendFrontType = BackendFrontEnum.getEnumByCode(deployDataDTO.getBackendFrontType());
if (BackendFrontEnum.BACKEND.equals(backendFrontType)) {
continue;
}
String serviceName = deployDataDTO.getServiceName();
FrontInstanceDto frontInstanceDto = frontInstanceDtoMap.get(serviceName);
......@@ -69,6 +67,10 @@ public class GeneratorGitJobScript {
frontInstanceDto.setServiceNameSub(serviceNameSub);
frontInstanceDto.setServiceNameCookie(serviceNameCookie);
frontInstanceDto.setServiceNameAbb(deployDataDTO.getServiceNameAbb());
frontInstanceDto.setGitPath(deployDataDTO.getGitPath());
frontInstanceDto.setGitBuildSub(deployDataDTO.getGitBuildSub());
frontInstanceDto.setBackendFrontType(backendFrontType);
frontInstanceDto.setDeployJar(deployDataDTO.getDeployJar());
frontInstanceDtoMap.put(serviceName, frontInstanceDto);
}
......@@ -90,14 +92,6 @@ public class GeneratorGitJobScript {
return;
}
// Map model = new HashMap();
// model.put("serviceNameSub", frontInstanceDto.getServiceNameSub());
// model.put("serviceNameCookie", frontInstanceDto.getServiceNameCookie());
// model.put("serviceName", frontInstanceDto.getServiceName());
// model.put("serviceNameAbb", frontInstanceDto.getServiceNameAbb());
// model.put("grayList", frontInstanceDto.getGrayList());
// model.put("normalList", frontInstanceDto.getNormalList());
buildInitEnv(frontInstanceDto);
});
......@@ -133,8 +127,15 @@ public class GeneratorGitJobScript {
Map model = new HashMap();
model.put("deployJobName", jenkinsJobName);
model.put("serviceName", serviceName);
model.put("serviceNameSub", frontInstanceDto.getServiceNameSub());
model.put("serviceNameCookie", frontInstanceDto.getServiceNameCookie());
model.put("serviceNameAbb", frontInstanceDto.getServiceNameAbb());
model.put("gitPath", frontInstanceDto.getGitPath());
model.put("gitBuildSub", frontInstanceDto.getGitBuildSub());
model.put("deployJar", frontInstanceDto.getDeployJar());
String result = FreeMarkerUtils.process("jenkinsJobCreate.ftl", model);
String result = FreeMarkerUtils.process("git\\jenkinsJobCreateFlw.ftl", model);
FileUtils.appendNewLine(createJobFile, result);
String jobsDir = root_path_jenkins_full + "\\" + jenkinsJobName;
......@@ -143,15 +144,17 @@ public class GeneratorGitJobScript {
jobsFolder.mkdirs();
}
// if (BackendFrontEnum.BACKEND.equals(frontInstanceDto.getBackendFrontType())) {
//
// }
String configFilePath = jobsDir + "\\config.xml";
String jobConfig = FreeMarkerUtils.process("jenkinsJobGit.ftl", model);
String jobConfig = FreeMarkerUtils.process("git\\jenkinsJobGitBackend.ftl", model);
FileUtils.appendNewLine(configFilePath, jobConfig);
}
private static String createJenkinsJobName(String serviceName) {
if ("getway".equals(serviceName)) {
serviceName = "gateway";
}
......
......@@ -154,7 +154,7 @@ public class GeneratorScript {
String nginxConfigShFileName = fileDir + "\\copyNginxConfig.sh";
String nginxConfigShResult = FreeMarkerUtils.process("copyNginxConfig.ftl", null);
String nginxConfigShResult = FreeMarkerUtils.process("sh\\copyNginxConfig.ftl", null);
FileUtils.write(nginxConfigShFileName, nginxConfigShResult);
}
......@@ -199,12 +199,12 @@ public class GeneratorScript {
model.put("serviceNameAbb", serviceNameAbb);
model.put("springProfilesActive", springProfilesActive);
String result = FreeMarkerUtils.process("bootstrap.ftl", model);
String result = FreeMarkerUtils.process("sh\\bootstrap.ftl", model);
FileUtils.write(bootstrapFileName, result);
String deployShFileName = fileDir + "\\deploy-" + serviceName + "-" + port + ".sh";
String deployShResult = FreeMarkerUtils.process("deploy-sh.ftl", model);
String deployShResult = FreeMarkerUtils.process("sh\\deploy-sh.ftl", model);
FileUtils.write(deployShFileName, deployShResult);
}
......@@ -250,16 +250,16 @@ public class GeneratorScript {
model.put("frontGroup", frontGroup);
String deployShFileName = fileDir + "\\deploy-" + serviceName + "-" + port + ".sh";
String deployShResult = FreeMarkerUtils.process("deploy-web-sh.ftl", model);
String deployShResult = FreeMarkerUtils.process("sh\\deploy-web-sh.ftl", model);
if ("portal-web".equals(serviceName)) {
deployShResult = FreeMarkerUtils.process("deploy-portal-web-sh.ftl", model);
deployShResult = FreeMarkerUtils.process("sh\\deploy-portal-web-sh.ftl", model);
}
FileUtils.write(deployShFileName, deployShResult);
if (StringUtils.isNotBlank(nginxConfigName)) {
String nginxName = root_path_full + "\\" + fixedIp + "\\nginxConfig" + "\\" + nginxConfigName;
String nginxConfigResult = FreeMarkerUtils.process("nginx_config.ftl", model);
String nginxConfigResult = FreeMarkerUtils.process("sh\\nginx_config.ftl", model);
FileUtils.write(nginxName, nginxConfigResult);
}
......@@ -271,7 +271,7 @@ public class GeneratorScript {
String nginxConfigDir = root_path_full + "\\zww-nginx.conf";
FileUtils.appendNewLine(nginxConfigDir, "----------------------------------"+ model.get("serviceName") + "----------------------------------");
String nginxConfig = FreeMarkerUtils.process("zww-nginx-upstream.ftl", model);
String nginxConfig = FreeMarkerUtils.process("sh\\zww-nginx-upstream.ftl", model);
FileUtils.appendNewLine(nginxConfigDir, nginxConfig);
}
......@@ -280,7 +280,7 @@ public class GeneratorScript {
String nginxConfigDir = root_path_full + "\\hlw-nginx.conf";
FileUtils.appendNewLine(nginxConfigDir, "----------------------------------"+ model.get("serviceName") + "----------------------------------");
String nginxConfig = FreeMarkerUtils.process("hlw-nginx-upstream.ftl", model);
String nginxConfig = FreeMarkerUtils.process("sh\\hlw-nginx-upstream.ftl", model);
FileUtils.appendNewLine(nginxConfigDir, nginxConfig);
}
}
......@@ -13,6 +13,14 @@ public class FrontInstanceDto {
private String serviceNameAbb;
private String gitPath;
private String gitBuildSub;
private BackendFrontEnum backendFrontType;
private String deployJar;
List<String> grayList = new ArrayList<>();
List<String> normalList = new ArrayList<>();
......@@ -42,6 +50,46 @@ public class FrontInstanceDto {
this.serviceNameCookie = serviceNameCookie;
}
public String getServiceNameAbb() {
return serviceNameAbb;
}
public void setServiceNameAbb(String serviceNameAbb) {
this.serviceNameAbb = serviceNameAbb;
}
public String getGitPath() {
return gitPath;
}
public void setGitPath(String gitPath) {
this.gitPath = gitPath;
}
public String getGitBuildSub() {
return gitBuildSub;
}
public void setGitBuildSub(String gitBuildSub) {
this.gitBuildSub = gitBuildSub;
}
public BackendFrontEnum getBackendFrontType() {
return backendFrontType;
}
public void setBackendFrontType(BackendFrontEnum backendFrontType) {
this.backendFrontType = backendFrontType;
}
public String getDeployJar() {
return deployJar;
}
public void setDeployJar(String deployJar) {
this.deployJar = deployJar;
}
public List<String> getGrayList() {
return grayList;
}
......@@ -57,12 +105,4 @@ public class FrontInstanceDto {
public void setNormalList(List<String> normalList) {
this.normalList = normalList;
}
public String getServiceNameAbb() {
return serviceNameAbb;
}
public void setServiceNameAbb(String serviceNameAbb) {
this.serviceNameAbb = serviceNameAbb;
}
}
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.13">
<gitLabConnection>gitlab140</gitLabConnection>
</com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>projectCode</name>
<description>项目编号</description>
<defaultValue></defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>modelServiceName</name>
<description>模块服务名</description>
<defaultValue></defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>modelVersion</name>
<description>模块版本</description>
<defaultValue></defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
<net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition plugin="git-parameter@0.9.13">
<name>branch</name>
<description>分支或标签</description>
<uuid>f4713994-385b-46c5-8a58-a6ee623707f9</uuid>
<type>PT_BRANCH_TAG</type>
<branch></branch>
<tagFilter>*</tagFilter>
<branchFilter>.*</branchFilter>
<sortMode>NONE</sortMode>
<defaultValue>origin/master</defaultValue>
<selectedValue>NONE</selectedValue>
<quickFilterEnabled>false</quickFilterEnabled>
<listSize>5</listSize>
</net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@4.4.5">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>http://39.100.254.140:12011/spring-timeloit/spring-timeloit.git</url>
<credentialsId>gitlab140-jenkins</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>${branch}</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<authToken>11eb77e9cdda37fa642b028c5d7c65dd4c</authToken>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Maven>
<targets>clean install -Dmaven.test.skip=true -U</targets>
<mavenName>maven</mavenName>
<usePrivateRepository>false</usePrivateRepository>
<settings class="jenkins.mvn.DefaultSettingsProvider"/>
<globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
<injectBuildVariables>false</injectBuildVariables>
</hudson.tasks.Maven>
<hudson.tasks.Shell>
<command>echo &quot;###################pushing jar to versionserver #############&quot;
echo &quot;######################print param begin######################&quot;
echo &apos;projectCode:&apos; + $projectCode
echo &apos;modelServiceName:&apos; + $modelServiceName
echo &apos;modelVersion:&apos; + $modelVersion
echo &apos;branch:&apos; +$branch
echo &quot;######################print param end######################&quot;
echo &quot;##################create remore dist begin#############&quot;
destDir=&quot;/home/version/push-jar/${projectCode}/${modelServiceName}/${modelVersion}&quot;
echo &apos;please check destDir is include projectCode、modelServiceName、modelVersion:&apos; + $destDir
if [ -z &quot;$projectCode&quot; ]; then
echo &apos;projectCode must not be empty&apos;
exit -1
fi
if [ -z &quot;$modelServiceName&quot; ]; then
echo &apos;modelServiceName must not be empty&apos;
exit -1
fi
if [ -z &quot;$modelVersion&quot; ]; then
echo &apos;modelVersion must not be empty&apos;
exit -1
fi
if [ -z &quot;$modelVersion&quot; ]; then
echo &apos;modelVersion must not be empty&apos;
exit -1
fi
ssh root@192.169.201.14 &quot;
pwd &amp;&amp;
mkdir -p $destDir &amp;&amp;
ls -la $destDir&quot;
echo &quot;##################create remore dist end#############&quot;
echo &quot;##################pussing jar begin#############&quot;
scp loit-service/loit-portal/target/loit-portal.jar root@192.169.201.14:$destDir
echo &quot;##################pussing jar end#############&quot;
</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers>
<hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.38">
<deleteDirs>false</deleteDirs>
<cleanupParameter></cleanupParameter>
<externalDelete></externalDelete>
<disableDeferredWipeout>false</disableDeferredWipeout>
</hudson.plugins.ws__cleanup.PreBuildCleanup>
</buildWrappers>
</project>
\ No newline at end of file
curl -X POST -u admin:adminloit -H "Content-Type:application/xml" -d "@config.xml" http://192.168.188.15:12012/createItem?name=${deployJobName}
......@@ -48,7 +48,7 @@
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>http://39.100.254.140:12011/spring-timeloit/spring-timeloit.git</url>
<url>${gitPath}</url>
<credentialsId>gitlab140-jenkins</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
......@@ -81,14 +81,12 @@
<command>echo &quot;###################pushing jar to versionserver #############&quot;
echo &quot;######################print param begin######################&quot;
echo &apos;projectCode:&apos; + $projectCode
echo &apos;modelServiceName:&apos; + $modelServiceName
echo &apos;modelVersion:&apos; + $modelVersion
echo &apos;branch:&apos; +$branch
echo &quot;######################print param end######################&quot;
echo &quot;##################create remore dist begin#############&quot;
......@@ -126,7 +124,7 @@
echo &quot;##################pussing jar begin#############&quot;
scp loit-service/loit-portal/target/loit-portal.jar root@192.169.201.14:$destDir
scp ${gitBuildSub}${deployJar} root@192.169.201.14:$destDir
echo &quot;##################pussing jar end#############&quot;
</command>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论