Jenkins配置流水线任务-实践操作(Pipeline-script)
1、新增jenkins 任务,选择流水线
2、参数化
3、流水线配置
pipeline {
agent any
stages {
stage('aoePlugin_mysql') {
steps {
echo "xxx,数据库:Mysql"
echo "${HOST},${USER_NAME}"
build job: 'xxx_MainProcessTest_master', parameters: [
string(name: 'mainTestCase', value: "test1"),
string(name: 'DBTYPE', value: 'mysql'),
string(name: 'HOST', value: "${HOST}"),
string(name: 'USER_NAME', value: "${USER_NAME}"),
string(name: 'USER_SECRET', value: "${USER_SECRET}")
]
}
}
stage('sdd') {
steps {
echo 'xx自动化测试'
build job: 'xxx_MainProcessTest_master', parameters: [
string(name: 'mainTestCase', value: "test2"),
string(name: 'DBTYPE', value: 'mysql'),
string(name: 'HOST', value: "${HOST}"),
string(name: 'USER_NAME', value: "${USER_NAME}"),
string(name: 'USER_SECRET', value: "${USER_SECRET}")
]
}
}
stage('NoSQLTest_allDe') {
steps {
echo 'xxx自动化测试'
build job: 'xxx_MainProcessTest_master', parameters: [
string(name: 'mainTestCase', value: "test3"),
string(name: 'HOST', value: "${HOST}"),
string(name: 'USER_NAME', value: "${USER_NAME}"),
string(name: 'USER_SECRET', value: "${USER_SECRET}")
]
}
}
stage('xxx_WebInterfaceAutoTest') {
steps {
echo "xxx_web接口自动化测试"
echo "${HOST},${USER_NAME}"
build job: 'xxx_WebInterfaceAutoTest', parameters: [
string(name: 'HOST', value: "${HOST}"),
string(name: 'USER_NAME', value: "${USER_NAME}"),
string(name: 'USER_SECRET', value: "${USER_SECRET}")
]
}
}
stage('xxx_SDKTest') {
steps {
echo "xxx_SDKTest"
echo "${HOST},${USER_NAME}"
build job: 'xxx_SDKTest', parameters: [
string(name: 'HOST', value: "${HOST}"),
string(name: 'USER_NAME', value: "${USER_NAME}"),
string(name: 'USER_SECRET', value: "${USER_SECRET}")
]
}
}
}
}
}
4、执行结果