DevOps use Pipeline's integrated jmeter tested in the jenkins

No test of integration is not a complete, integrated, and tested there this week to communicate a little, put jmeter detection module integrated into it, looked rough idea is:

  1. The local jmeter mount to jenkins-slave in
  2. In order to carry out the execution jmeter detection,
  3. The report is then stored locally, using a display server nginx, (here the output of the report has been entangled, a final decision is then stored locally to hang out with nginx)

Combined with a rule naming the various systems: firstly girlab project called name of the Lord, and asked to build a test project named gitlab and + suffix jmx (gitlab project name starting with the letter word can, use long names in the dash - can not be used underline and other characters)

 stage('jmeter test'){
          sh "cd eureka "
          sh "ls -alt /usr/local/jmeter51/report"
          checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'fb1ea0bb-ff11-449d-bf11-32f687453930', url: 'http://192.168.11.114/root/jmeter-jmx.git']]])
          sh "mkdir -p /usr/local/jmeter51/report/${env.JOB_NAME}/${env.BUILD_NUMBER}"
          sh "${jmeter} -n -t ${env.JOB_NAME}.jmx -l /usr/local/jmeter51/report/${env.JOB_NAME}/${env.BUILD_NUMBER}/test.jtl -e -o /usr/local/jmeter51/report/${env.JOB_NAME}/${env.BUILD_NUMBER}/test"
      }     

Adding an automatic test using jenkins pipeline to all modules can be used directly

podTemplate(label: 'jnlp-slave', cloud: 'kubernetes', containers: [
    containerTemplate(
        name: 'jnlp', 
        image: '192.168.111.118:82/library/jenkins-slave:latest', 
        alwaysPullImage: true 
    ),
  ],
  volumes: [
    hostPathVolume(mountPath: '/usr/local/jdk', hostPath: '/usr/local/jdk'),
    nfsVolume(mountPath: '/usr/local/jmeter51', readOnly: false, serverAddress: '192.168.111.118', serverPath: '/usr/local/jmeter51'),
  ],
  imagePullSecrets: ['registry-key'],
) 
{
 node("jnlp-slave"){
      def bearychat_url = "https://hook.bearychat.com/=bwGGG/jenkins/4f85769324a1b6ec7a32266819cf2e64"
      def mvn_com = "/usr/local/maven/bin/mvn"
      def jmeter = "/usr/local/jmeter51/bin/jmeter"
      def jmeter_re = "/usr/local/jmeter51/report/"
     stage('Git Checkout'){
         checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'fb1ea0bb-ff11-449d-bf11-32f687453930', url: 'http://192.168.11.114/root/jmeter-jmx.git']]])
       }

      stage('jmeter test'){
              
                 out = sh(script: "ls *.jmx ", returnStdout: true).toString().trim()
                 size = out.size()
                 println "${out}"
                 str5 = out.split()
                 for (int i = 0;i < str5.size();++i){
                       sh  "mkdir -p ${jmeter_re}all-${env.BUILD_NUMBER}/${str5[i]}/"
                       sh "${jmeter} -n -t ${str5[i]} -l ${jmeter_re}all-${env.BUILD_NUMBER}/${str5[i]}.jtl  -e -o ${jmeter_re}all-${env.BUILD_NUMBER}/${str5[i]}/test " 
                    }
                 
          
      }     
   }
}

Reproduced in: https: //www.jianshu.com/p/381b6393f017

Guess you like

Origin blog.csdn.net/weixin_34061555/article/details/91212933