Commit e27ddcba authored by zhouzihao's avatar zhouzihao

dev-添加项目源数据的额外参数

parent aceacc36
......@@ -3,6 +3,8 @@ stages:
- javacheck
- builddocker
- dockercheck
- dockerdeploy
- deploycheck
- cus
variables:
......@@ -21,7 +23,7 @@ buildjava:
tags:
- share
only:
- /^(r|t)-([0-9]+).([0-9]+).([0-9]+)/
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
javacheck:
image: curlimages/curl
......@@ -32,7 +34,7 @@ javacheck:
tags:
- share
only:
- /^(r|t)-([0-9]+).([0-9]+).([0-9]+)/
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
dockercheck:
image: curlimages/curl
......@@ -43,7 +45,7 @@ dockercheck:
tags:
- share
only:
- /^(r|t)-([0-9]+).([0-9]+).([0-9]+)/
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
builddocker:
stage: builddocker
......@@ -57,7 +59,28 @@ builddocker:
tags:
- share
only:
- /^(r|t)-([0-9]+).([0-9]+).([0-9]+)/
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
dockerdeploy:
stage: dockerdeploy
script:
- echo "deploy!"
{deploy_str}
tags:
- {tag}
only:
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
deploycheck:
image: curlimages/curl
stage: deploycheck
script:
{fail_str}
when: on_failure
tags:
- share
only:
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
sucback:
stage: cus
......@@ -67,4 +90,4 @@ sucback:
tags:
- share
only:
- /^(r|t)-([0-9]+).([0-9]+).([0-9]+)/
\ No newline at end of file
- /^v-([0-9]+).([0-9]+).([0-9]+)-([0-9])+/
\ No newline at end of file
FROM 10.100.9.22:2080/public/openjdk8-jdk-alpine:latest
ARG RUNPRO
VOLUME /tmp
VOLUME /opt/logs
WORKDIR /opt/
{docker-file-str}
COPY {service}/target/{service-exec}.jar {service}.jar
ENTRYPOINT ["java","-jar","{service}.jar","--spring.profiles.active=${RUNPRO}"]
\ No newline at end of file
......@@ -138,6 +138,8 @@ const buildJava = async (projectObj, envObj, typeObj, configList, branch, versio
//构建项目的服务名
var deploy_name = "";
let docker_file_str = ""
if (_.isString(v)) {
module_name = v;
opt = { filePath: project_dir + "/" + v + "/pom.xml" }
......@@ -148,6 +150,12 @@ const buildJava = async (projectObj, envObj, typeObj, configList, branch, versio
throw new Error("错误的类型")
}
// 读取项目源数据的的dockerfile的额外配置
if (_.isObject(v) && _.has(v, "docker-file-str")) {
// fixme need keep dangerous command away~
docker_file_str = _.get(v, "docker-file-str");
}
deploy_name = envObj.name + "-" + module_name;
if (_.isObject(v) && _.has(v, `deploy.${envObj.name}`)) {
deploy_name = _.get(v, `deploy.${envObj.name}`);
......@@ -182,6 +190,7 @@ const buildJava = async (projectObj, envObj, typeObj, configList, branch, versio
fs.writeFileSync(`${project_dir}/${dockerfile_name}`, typeObj.docker_file);
var dockerfile_map = {
"{docker-file-str}": docker_file_str,
"{service}": module_name,
"{service-exec}": exec_file
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment