wangzilun
2022-03-08 1961203b2c9c03e98791bdee99c79cc75c972fe8
Jenkinsfile
@@ -29,6 +29,16 @@
                                    , userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS_ID}", url: "${url}"]]
                                    ])
                     println "changeLogSets ${changeLogSets}"
                     GIT_COMMIT = changeLogSets['GIT_COMMIT']
                     GIT_PREVIOUS_COMMIT = changeLogSets['GIT_PREVIOUS_COMMIT']
                     env.GIT_COMMIT_AUTHOR = sh (script: 'git log -1 --oneline --pretty=%an ${GIT_COMMIT}', returnStdout: true).trim()
                     env.GIT_COMMIT_MSG = sh '''
                         git log --oneline --pretty=%s ${GIT_PREVIOUS_COMMIT}...${GIT_COMMIT}
                         '''
                     //sh (script: '', returnStdout: true).trim()
                }
            }
        }
@@ -40,17 +50,6 @@
            //}
        //}
        stage('testFunction') {
            steps {
                sh '''
                    commit_name="\$(git show -s --pretty=%an)"
                    commit_message="\$(git show -s --pretty=%s)"
                    echo "\$commit_name"
                    echo "\$commit_message"
                    printenv
                '''
            }
        }
        //将项目打成war并归档,将配置文件目录存入stash
        stage('package') {
@@ -123,4 +122,13 @@
            }
        }
    }
    post {
        always {
            echo "执行完成 \n提交人:${env.GIT_COMMIT_AUTHOR}\n提交信息:\n${env.GIT_COMMIT_MSG}"
        }
        unsuccessful{
            echo 'unsuccessful '
        }
    }
}