pipeline {
parameters {
string(defaultValue: 'master', description: '', name: 'BRANCH')
}
agent { node { label 'test' } }
stages {
stage('Prepare') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: "${BRANCH}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'RelativeTargetDirectory',
relativeTargetDir: ''],
[$class: 'CloneOption',
honorRefspec: true,
noTags: false,
reference: '',
shallow: false,
timeout: 30]],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: '1*****c',
refspec: "+refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}",
url: 'git@git.ringcentral.com:***/***.git']]])
}
}
stage('Build') {
steps {
script {
sh '''
cp ./CI-files/DockerBases/Dockerfile.jmeter-plugin .
cp ./CI-files/JMeter/build.sh .
cp ./CI-files/JMeter/run.sh .
cp ./CI-files/JMeter/entrypoint.sh .
ls
chmod +x $WORKSPACE/run.sh
chmod +x $WORKSPACE/entrypoint.sh
chmod +x $WORKSPACE/build.sh
$WORKSPACE/build.sh
'''
}
}
}
stage('Test') {
steps {
script {
sh '''
export SCRIPT="test/LTI_Test_Plan.jmx"
export JTL="test/LTI_Test_Plan.jtl"
export LOG="test/LTI_Test_Plan.log"
export Report="./Report"
rm -rf ${JTL} ${LOG} ${Report}
$WORKSPACE/run.sh -n -t ${SCRIPT} -l ${JTL} -j ${LOG} -e -o ${Report}
docker rm jmeter
'''
}
}
}
stage('Report') {
steps {
dir("$WORKSPACE") {
publishHTML (target : [allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'Report',
reportFiles: 'index.html',
reportName: 'LIT Performance Test Report'])
}
}
}
}
}
评论