...
|
...
|
@@ -17,7 +17,6 @@ pipeline { |
|
|
QA_EMAIL='jimi.ji@yoho.cn'
|
|
|
NODE_ENV='production'
|
|
|
KUBERNETES_DEPLOY_YAML='git@git.yoho.cn:docker/k8s-deploy-yaml.git'
|
|
|
IMAGEVERSION="""${sh(returnStdout: true,script: 'date +"%Y%m%d%H%M%S"')}"""
|
|
|
}
|
|
|
|
|
|
options {
|
...
|
...
|
@@ -26,18 +25,25 @@ pipeline { |
|
|
}
|
|
|
|
|
|
stages {
|
|
|
stage('init envrionment ') {
|
|
|
stage('init envrionment and global var') {
|
|
|
steps {
|
|
|
script {
|
|
|
if(params.projectName==''){
|
|
|
error "no project ${params.projectName}"
|
|
|
}
|
|
|
def PROJECT_WORK_DIR="${env.WORKSPACE}/${params.projectName}"
|
|
|
def IMAGEVERSION="""${sh(returnStdout: true,script: 'date +"%Y%m%d%H%M%S"')}"""
|
|
|
def IMAGEVERSION = IMAGEVERSION.trim();
|
|
|
PROJECT_WORK_DIR="${env.WORKSPACE}/${params.projectName}"
|
|
|
QCLOUD_IMAGE_STORE="ccr.ccs.tencentyun.com/${params.imageSource}/${params.deployName}:${IMAGEVERSION}"
|
|
|
if(fileExists("${PROJECT_WORK_DIR}/")){
|
|
|
echo "starting delete the dir ${PROJECT_WORK_DIR}"
|
|
|
sh "rm -rf ${PROJECT_WORK_DIR}"
|
|
|
}
|
|
|
DEPLOY_YAML_WORK_DIR="${env.WORKSPACE}/${k8s-deploy-yaml}"
|
|
|
if(fileExists("${DEPLOY_YAML_WORK_DIR}/")){
|
|
|
echo "starting delete the deploy yaml : ${DEPLOY_YAML_WORK_DIR}"
|
|
|
sh "rm -rf ${DEPLOY_YAML_WORK_DIR}"
|
|
|
}
|
|
|
}
|
|
|
echo "PRINT THE PARA projectName ${params.projectName}......"
|
|
|
echo "PRINT THE PARA projectGitGroup ${params.projectGitGroup}......"
|
...
|
...
|
@@ -50,21 +56,21 @@ pipeline { |
|
|
}
|
|
|
}
|
|
|
|
|
|
stage('git clone code') {
|
|
|
stage('git clone project code && deploy yaml') {
|
|
|
steps {
|
|
|
script {
|
|
|
echo "begin clone the project code"
|
|
|
sh "git clone -b ${params.branch} git@git.yoho.cn:${params.projectGitGroup}/${params.projectName}.git ${PROJECT_WORK_DIR}"
|
|
|
sh "git clone ${env.KUBERNETES_DEPLOY_YAML} ${DEPLOY_YAML_WORK_DIR}"
|
|
|
echo "starting check the project ${PROJECT_WORK_DIR}"
|
|
|
echo "starting check the project ${QCLOUD_IMAGE_STORE}"
|
|
|
// sh "git clone -b ${params.branch} git@git.yoho.cn:${params.projectGitGroup}/${params.projectName}.git ${PROJECT_WORK_DIR}"
|
|
|
// echo "starting check the project {params.projectName}"
|
|
|
// if(!fileExists("${PROJECT_WORK_DIR}/docker.sh")){
|
|
|
// echo "you need docker.sh file in project ${params.projectName}"
|
|
|
// error "you need docker.sh file in project ${params.projectName}"
|
|
|
// }
|
|
|
// if(!fileExists("${PROJECT_WORK_DIR}/Dockerfile")){
|
|
|
// echo "you need Dockerfile file in project ${params.projectName}"
|
|
|
// error "you need Dockerfile file in project ${params.projectName}"
|
|
|
// }
|
|
|
if(!fileExists("${PROJECT_WORK_DIR}/docker.sh")){
|
|
|
echo "you need docker.sh file in project ${params.projectName}"
|
|
|
error "you need docker.sh file in project ${params.projectName}"
|
|
|
}
|
|
|
if(!fileExists("${PROJECT_WORK_DIR}/Dockerfile")){
|
|
|
echo "you need Dockerfile file in project ${params.projectName}"
|
|
|
error "you need Dockerfile file in project ${params.projectName}"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|