wangzilun
2022-01-18 d10f033d23712bad0f5ef76774642f1d34b19e82
Jenkinsfile
@@ -10,6 +10,7 @@
        }
    options {
        //给日志加上时间错, 需安装 Timestamper 插件
        //mvn test surefire-report:report
        timestamps()
        ansiColor('xterm')
        //丢弃旧的构建前两个为发布包保留天数(比此早的发布包将被删除,但构建的日志、操作历史、报告等将被保留)和构建个数
@@ -29,7 +30,15 @@
            }
        }
        stage('test') {
        stage('testMaven') {
            steps {
                sh 'mvn clean test -U'
                junit allowEmptyResults: true, keepLongStdio: true, skipPublishingChecks: true, testResults: 'target/surefire-reports/*.xml'
            }
        }
        stage('testFunction') {
            steps {
                sh '''
@@ -71,6 +80,10 @@
        }
        stage('version add') {
            when {
                //版本号自动添加逻辑需同时符合下列触发条件:
                //1. 不能在master分支触发
                //2. 有任意浏览器页面资源文件修改
                //3. 不包含[项目名.java]文件的修改
                allOf {
                    not {
                        branch 'master'
@@ -88,10 +101,9 @@
                    }
                }
            }
            steps{
                echo "todo add version"
            steps {
                versionAddTest("${project_name}","${GIT_CREDENTIALS_ID}","${url}","${GIT_BRANCH}")
            }
        }
        stage('deploy') {
            when { branch 'master' }