jenkins-pipeline-dataengine1.0-CI
admin
2023-03-10 15:42:41
0

jenkins-pipeline-dataengine1.0-CI

#!groovy
timestamps {

group_id = "enn.cn.encdata"
artifact_id = "dataengine1.0"
version = ""
packaging = "tar.gz"
artifact_description = "dataengine1.0 artifacts"
group_id_path = group_id.replaceAll("\.", "/")
nexus_encdata_ci_url = "http://101.139.139.153:38090/service/local/repositories/encdata-ci/content"

node{
remote_rootdir = WORKSPACE.replaceAll("/workspace/${JOB_BASE_NAME}", "")

stage("CheckOut dataengine1.0") {
    git_repo_url = "ssh://git@101.139.139.318:12020/${repo_name}"
    //checkout([$class: 'GitSCM', branches: [[name: "*/${branch_name}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${working_dir}"], [$class: 'CheckoutOption', timeout: 100]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'gitlab-10.7.0', url: "${git_repo_url}"]]])
    //checkout([$class: 'GitSCM', branches: [[name: "*/${branch_name}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${working_dir}"], [$class: 'CheckoutOption', timeout: 100]], submoduleCfg: [], userRemoteConfigs: [[url: "${git_repo_url}"]]])

    sh """if [ -d ${working_dir}/.git ]; then
        cd ${working_dir};
        current_branch=\$(git branch |sed -e "s/\\* //g");
        if [ \"\${current_branch}\" != \"${branch_name}\" ]; then
            git checkout -f .;
            git checkout -b ${branch_name};
            git pull ${git_repo_url} ${branch_name};
        else
            git checkout -f .;
            git pull ${git_repo_url} ${branch_name};
        fi    
    else
        git clone ${git_repo_url} -b ${branch_name} ${working_dir};
    fi"""

}

stage("Build dataengine1.0") {
    sh "cd ${working_dir} && pwd && cd dataengine-parent && mvn clean compile package -DskipTests=true"
    //sh "cd ${working_dir} && cd 03src/61updatesvr/updateapp/prj_linux64_ubuntu && make clean && make DEBUG:=1"
    //sh "cd ${working_dir} && cp ${remote_rootdir}/server/mvsapp 01bin/deployment/MVS.Server/update_3.0.1.x && cp ${remote_rootdir}/server/WatchDog.out 01bin/deployment/MVS.Server/update_3.0.1.x && cp -rf 01bin/algorithmconfig 01bin/deployment/MVS.Server/update_3.0.1.x && cd 01bin/deployment/MVS.Server/update_3.0.1.x && DATE=\$(date) && sed -i \"s/3.x.x.x/${product_version}/g\" config.xml && sed -i \"s/3.x.x.x/${product_version}/g\" update.xml && sed -i \"s/mvs_compile_date/\${DATE}/g\" update.xml"
    //sh "cd ${working_dir} && cd 01bin/deployment/MVS.Server && cp -rf update_3.0.1.x update_${product_version} && rm -rf update_3.0.1.x"
    //sh "cd ${working_dir} && cd 01bin/deployment && rm -rf MVS_*_Server && rm -f MVS_*_Server.zip && mkdir MVS_${product_version}_Server && cp -rf MVS.Server/* MVS_${product_version}_Server"
}

stage("SonarQube analysis") {
    sh "cd ${working_dir} && cd dataengine-parent && mvn sonar:sonar -Dsonar.projectKey=dataengine1.0 -Dsonar.host.url=http://101.139.139.153:19000 -Dsonar.login=2f878304a05ab656bce3e9fd0fe948f7eefbd6d4"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"

}

stage("Release NexusOSS") {
    //sh "cd ${working_dir} && pwd && cd dataengine-core/target && mvn deploy:deploy-file -DgroupId=com.encdata -DartifactId=dataengine -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=/data/jenkins/workspace/pipeline-dataengine1.0-CI/dataengine1.0/dataengine-core/target/data-engine.jar -Durl=http://101.139.139.153:88090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"

}

stage("Release Tests") {
    //sh "cd ${working_dir} && pwd && cd dataengine-core/target && scp data-engine.jar root@101.119.146.100:/mnt/data/deploy/scmdeploy"
    //sh "cd ${working_dir} && pwd && mvn deploy:deploy-file -DgroupId=com.encdata -DartifactId=web-bcm -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/data/jenkins/workspace/build-BASE-COMPONENTS-CI/BASE-COMPONENTS/target/web-bcm.jar -Durl=http://101.139.139.153:88090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"
}

stage("Deploy 131") {
    //sh "cd ${working_dir} && pwd && cd dataengine-core/target && scp data-engine.jar root@101.119.151.131:/mnt/data/deploy/scmdeploy"
    //sh "cd ${working_dir} && pwd && mvn deploy:deploy-file -DgroupId=com.encdata -DartifactId=web-bcm -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/data/jenkins/workspace/build-BASE-COMPONENTS-CI/BASE-COMPONENTS/target/web-bcm.jar -Durl=http://101.139.139.153:88090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"
}

stage("Deploy 141") {
    //sh "cd ${working_dir} && pwd && cd dataengine-core/target && scp data-engine.jar root@101.119.151.141:/mnt/data/deploy/scmdeploy"
    //sh "cd ${working_dir} && pwd && mvn deploy:deploy-file -DgroupId=com.encdata -DartifactId=web-bcm -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/data/jenkins/workspace/build-BASE-COMPONENTS-CI/BASE-COMPONENTS/target/web-bcm.jar -Durl=http://101.139.139.153:88090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"
}

stage("Send mail") {
    sh "mail bcc: '', body: 'Here is the content.', cc: 'yinjigang@encdata.cn', from: '', replyTo: '', subject: 'subject', to: 'yinjigang@encdata.cn'"
    //sh "cd ${working_dir} && pwd && mvn deploy:deploy-file -DgroupId=com.encdata -DartifactId=web-bcm -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/data/jenkins/workspace/build-BASE-COMPONENTS-CI/BASE-COMPONENTS/target/web-bcm.jar -Durl=http://101.139.139.153:88090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots"
    //sh "cd ${working_dir} && cd proxy-gateway && mvn -B -Dmaven.test.skip=true clean package"
}

/*stage("Upload artifact") {
    version = sh (
        script: 'date +%Y%m%d-%H%M%S',
        returnStdout: true
    ).trim()

    sh "cd ${working_dir} && cd 01bin/deployment && is_exist_file=\$(ls ${artifact_id}*.${packaging} |wc -l) && if [ \${is_exist_file} -ne 0 ]; then rm -f ${artifact_id}*.${packaging}; fi"
    sh "cd ${working_dir} && cd 01bin/deployment && tar -czvf ${artifact_id}-${version}.${packaging} MVS_${product_version}_Server"
    sh "cd ${working_dir} && cd 01bin/deployment && mv ${artifact_id}-${version}.${packaging} /tmp/ && /usr/bin/python ${remote_rootdir}/artifact_pull_push.py -g ${group_id} -a ${artifact_id} -v ${version} -p ${packaging} -P true -d '${artifact_description}'"
}*/

/*stage("jira issue") {
    if (issue_id != "") {
        withEnv(['JIRA_SITE=jira-7.8.9']) {
            echo "issue_id: ${issue_id}"

            //def fields = jiraGetFields idOrKey: "${issue_id}"
            //echo issue.data.toString()

            def issue = jiraGetIssue idOrKey: "${issue_id}"
            issue_type = issue.data.fields.issuetype.name
            issue_type_id = issue.data.fields.issuetype.id
            issue_status = issue.data.fields.status.name
            //echo issue.data.fields.issuetype.name
            //echo issue.data.fields.status.name

            if (issue_type == "任务" && issue_status == "已分配") {
                def transitionInput = [transition: [id: '71']]  // accept
                response = jiraTransitionIssue idOrKey: "${issue_id}", input: transitionInput
                echo response.successful.toString()
                echo response.data.toString()
            } else if (issue_type == "缺陷" && issue_status == "已分配") {
                def transitionInput = [transition: [id: '71']]  // confirm
                response = jiraTransitionIssue idOrKey: "${issue_id}", input: transitionInput
                echo response.successful.toString()
                echo response.data.toString()
            } else {
                echo "当前 Issue 状态为:${issue_status}, 状态不作更新!"
            }

            // add artifact download link
            nexus_artifact_url = nexus_encdata_ci_url + "/" + group_id_path + "/" + artifact_id + "/" + version + "/" + artifact_id+"-"+version+"."+packaging
            //jiraAddComment idOrKey: "${issue_id}", comment: "发布包下载:${nexus_artifact_url}"

            project_key = issue_id.replaceAll("-.*", "")
            echo "project_key: ${project_key}"
            def project = jiraGetProject idOrKey: "${project_key}"
            //echo project.data.toString()
            project_id = project.data.id.toString()

            def editIssue = [fields: [ project: [id: "${project_id}"],
                             customfield_10200: "${nexus_artifact_url}",
                             customfield_10201: ["${product_version}"],
                             issuetype: [id: "${issue_type_id}"]]]

            response = jiraEditIssue idOrKey: "${issue_id}", issue: editIssue
            issue_edit_response = response.successful.toString()
            echo "issue edit response: ${issue_edit_response}"
        }
    }
}*/

}

}

相关内容

热门资讯

“红霞”在登陆前为何爆发式增强... 昨天下午到夜间,台风“红霞”在近海岸登陆前,强度仍爆发式增强,从台风级加强为强台风级,中心附近最大风...
AI海上找鱼提升产量15%,下... 渔民出海捕鱼,以前赌的是经验和风浪。现在,可以依靠数据和算法。人工智能入局渔业,AI找鱼一找一个准。...
台风“红霞”一日连跳三级,将深... 今天(26日)凌晨3点50分前后,今年第12号台风“红霞”以强台风级登陆广东惠州市惠东县平海镇沿海,...
台风“红霞”以巅峰强度在惠州登... 今年第12号台风“红霞”(强台风级)的中心已于26日03时50分前后在广东省惠州市惠东县平海镇登陆,...
直击台风“红霞”登陆:楼在动,... 7月26日凌晨4时,惠东县小径湾。记者此刻正在一栋临海高层楼房的客厅里,双腿微微发颤——不是因为冷,...
人民日报:查处携程垄断案释放反... 林丽鹂 《人民日报》(2026年07月26日 第02版)携程垄断案的查处是平台经济反垄断常态化监管的...
以总理计划向特朗普递交伊朗情报 △以色列总理内塔尼亚胡(资料图)当地时间7月25日,总台记者自以色列方面获悉,以总理内塔尼亚胡及其访...
原创 手... 以前购买的手机想要用3天不充电,基本上是不可能的,但这两年手机电池技术有大突破,非重度使用的情况下,...
咪咕数媒亮相第34届全国图书交... 潮新闻客户端 记者 王景平 7月24日,第34届全国图书交易博览会盛大举办。作为数字文化领域的核心央...
王兴兴和他的机甲机器人登上《时... 当地时间7月23日,宇树科技创始人兼首席执行官王兴兴与该公司突破性的载人机甲机器人GD01共同登上美...