一、官方文档
https://jenkins.io/doc/pipeline/tour/deployment/
二、新建Pipeline项目
001.png
进入项目后,可以在【流水线-脚本】输入框中输入脚本
002.png
脚本模版
pipeline { agent any stages { stage('Build') { steps { echo 'Building' } } stage('Test') { steps { echo 'Testing' } } stage('Deploy') { steps { echo 'Deploying' } } } } |
脚本语法可以点击左下角的【流水线语法】,类似这个链接地址:http://192.168.11.21/jenkins/job/Jemter_autotest/pipeline-syntax/
把生成的脚本加入Pipeline脚本模版,如下
node { stage('Checkout') { git credentialsId: 'b6f83009-e1a3-4c52-b10e-a3652e0bc164', url: 'https://bestfei@bitbucket.org/bestfei/jemter_autotest.git' } stage('Test') { sh '/var/lib/jmeter/apache-jmeter-4.0/bin/jmeter -n -t /var/lib/jenkins/workspace/Jemter_autotest_Staging/cashalo.jmx -l /var/lib/jenkins/workspace/Jemter_autotest_Staging/test.jtl' } stage('Deploy') { sh 'cat /var/lib/jenkins/workspace/Jemter_autotest_Staging/test.jtl' } } |
配置完成保存,然后build此项目,查看结果如下:
003.png
上文内容不用于商业目的,如涉及知识产权问题,请权利人联系博为峰小编(021-64471599-8017),我们将立即处理。