Jenkinsfile 1.81 KiB
pipeline {
    agent any
    options {
        buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
        disableConcurrentBuilds()
        ansiColor('xterm')
    parameters {
        string(name: 'profiles', defaultValue: 'Gatekeeper', description: 'Gatekeeper,UI,EQP')
        string(name: 'Server', defaultValue: 'http://172.28.160.166:81', description: 'Test Server Address')
    stages {
        stage('Run Test') {
            agent {
                dockerfile true
            steps {
                configFileProvider([configFile(fileId: 'maven-settings',
                                                                   targetLocation: 'settings.xml',
                                                                   variable: 'MyGlobalSettings')]) {
                    script{
                        try{
                            sh "mvn -s $MyGlobalSettings  clean package -Dserver.base.url=$Server"
                        }catch(Exception e){
                            currentBuild.result="FAILURE"
                        stash includes: 'target/surefire-reports/*.xml', name: 'TestResult'
        stage('Record Test Result') {
            steps {
                script{
                    sh 'rm -rf target/surefire-reports'
                    unstash 'TestResult'
                    junit testResults: 'target/surefire-reports/*.xml'
                    allure([
                        includeProperties: false,
                        jdk: '',
                        properties: [],
                        reportBuildPolicy: 'ALWAYS',
                        results: [[path: 'target/surefire-reports']]