From 53137907b1ae9ff2a273a606a880270676a63287 Mon Sep 17 00:00:00 2001
From: jenkins <jenkins@hbbh.com>
Date: Wed, 13 Apr 2022 09:21:25 +0800
Subject: [PATCH] add version to 1.9.1

---
 Jenkinsfile |  134 --------------------------------------------
 1 files changed, 1 insertions(+), 133 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 17fe935..4513a10 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,135 +1,3 @@
 //utils 源码在jenkins-pipeline-library里
 @Library('utils')_
-pipeline {
-    agent { label '103' }
-
-    environment {
-            project_name = 'git_study'
-            url = 'http://47.92.145.232:8998/r/git_study.git'
-            GIT_CREDENTIALS_ID = '6abafc9e-1f0e-4d27-8389-7c81d69bcdb2'
-        }
-    options {
-        //给日志加上时间错, 需安装 Timestamper 插件
-        //mvn test surefire-report:report
-        timestamps()
-        ansiColor('xterm')
-        //丢弃旧的构建前两个为发布包保留天数(比此早的发布包将被删除,但构建的日志、操作历史、报告等将被保留)和构建个数
-        buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '10')
-
-    }
-    stages {
-        stage('source') {
-            steps {
-                checkout([$class: 'GitSCM'
-                , branches: [[name: "${GIT_BRANCH}"]]
-                , doGenerateSubmoduleConfigurations: false
-                , extensions: []
-                , submoduleCfg: []
-                , userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS_ID}", url: "${url}"]]
-                ])
-
-            }
-        }
-        stage('testMaven') {
-            steps {
-
-                sh 'mvn clean test -U'
-                junit allowEmptyResults: true, keepLongStdio: true, skipPublishingChecks: true, testResults: 'target/surefire-reports/*.xml'
-
-            }
-        }
-        stage('testFunction') {
-            steps {
-
-                sh '''
-                    #定义颜色的变量
-                    RED_COLOR='\\033[1;31m'   #红
-                    GREEN_COLOR='\\E[1;32m' #绿
-                    YELOW_COLOR='\\E[1;33m' #黄
-                    BLUE_COLOR='\\E[1;34m'  #蓝
-                    PINK='\\E[1;35m'        #粉红
-                    RES='\\E[0m'
-
-                    #需要使用echo -e,在字符串的最后定义了033[0m,它是用来恢复了默认的文本颜色设置,这样就只会得到一个彩色提示符,而不会影响命令和其输出的颜色显示(即黑底白字)。
-                    #一共有8种字体颜色可供选择,它们分别是30 (黑色)、31 (红色)、32 (绿色)、33 (黄色)、34 (蓝色)、35 ( 紫红色)、36 (青色)和37 (白色)。
-                    #对于底色也有8种颜色可供选择,例如40黑底、41红底、42绿底、43黄底、44蓝底、45紫底、46天蓝底、47白底。
-                    echo -e  "\${RED_COLOR}======red color======\${RES}"
-                    echo -e  "\${YELOW_COLOR}======yelow color======\${RES}"
-                    echo -e  "\${BLUE_COLOR}======green color======\${RES}"
-                    echo -e  "\${GREEN_COLOR}======green color======\${RES}"
-                    echo -e  "\${PINK}======pink color======\${RES}"
-                    echo -e "\\033[40;37m 黑底白字 \\033[0m"
-                    echo -e "\\033[46;37m 天蓝底白字 \\033[0m"
-                    echo -e "\\033[47;30m 白底黑字 \\033[0m"
-                    echo "#######################################"
-                    #直接把echo -e放到变量里面,使用的时候直接输出变量即可
-                    SETCOLOR_SUCCESS="echo -en \\033[1;32m"
-                    SETCOLOR_FAILURE="echo -en \\033[1;31m"
-                    SETCOLOR_WARNING="echo -en \\033[1;33m"
-                    SETCOLOR_NORMAL="echo -en \\033[0;39m"
-                    echo ----成功了!-----  &&  \$SETCOLOR_SUCCESS
-                    echo ----失败了!-----  &&  \$SETCOLOR_FAILURE
-                    echo ----需注意!-----  &&  \$SETCOLOR_WARNING
-                    echo ----正常的!-----  &&  \$SETCOLOR_NORMAL
-
-                    echo -e "\${GREEN_COLOR}BRANCH ${GIT_BRANCH}\${RES}"
-                    printenv
-                   '''
-                test("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
-            }
-        }
-
-        //将项目打成war并归档,将配置文件目录存入stash
-        stage('package') {
-            steps {
-                sh '''#!/bin/sh
-                    ####maven编译部署#####
-                    mvn clean package -U
-                    ##处理结果包
-                    old_version_all="\$(find . -iname "\${projectName}.java"| xargs sed -nr 's/^[^0-9]*\\"(([0-9]+\\.)*[0-9]+.*-[0-9]+)\\".*;/\\1/p\')"
-                    echo "old_version_all \$old_version_all"
-                    echo "project_name \$project_name"
-                    dir_name=\${project_name}"-"\$old_version_all
-                    echo "dir_name \$dir_name"
-                    cd target
-                    mkdir \$dir_name
-                    cp *.war \$dir_name
-                    zip -r "\$dir_name.zip" \$dir_name
-                '''
-            }
-        }
-        stage('version add') {
-            when {
-                //版本号自动添加逻辑需同时符合下列触发条件:
-                //1. 不能在master分支触发
-                //2. 有任意浏览器页面资源文件修改
-                //3. 不包含[项目名.java]文件的修改
-                allOf {
-                    not {
-                        branch 'master'
-                    }
-                    anyOf {
-                        changeset "**/*.js"
-                        changeset "**/*.css"
-                        changeset "**/*.html"
-                        changeset "**/*.xhtml"
-                        changeset "**/*.jpg"
-                        changeset "**/*.png"
-                    }
-                    not {
-                        changeset "**/${project_name}.java"
-                    }
-                }
-            }
-            steps {
-                versionAddTest("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
-            }
-        }
-        stage('deploy') {
-            when { branch 'master' }
-            steps {
-                sh 'echo test'
-            }
-        }
-    }
-}
\ No newline at end of file
+pipelineScript('git_study','http://47.92.145.232:8998/r/git_study.git')
\ No newline at end of file

--
Gitblit v1.9.1