pipeline 常用插件语句
1、checkout SCM 可以用来下载git仓代码,还可以支持cherry pick 某个patchcheckout([$class: 'GitSCM', branches: [[name: '*/master']], userRemoteConfigs: [[url: 'http://git-server/user/repository.git']]])
- url Type: String
- branch (optional) Type: String
- changelog (optional) Type: boolean
- credentialsId (optional) Type: String
- poll (optional) Type: boolean
用法:
checkout([$class: 'GitSCM', branches: [[name: "${branch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${relative_dir}"]], submoduleCfg: [], userRemoteConfigs: [[url: "${repo_url}"]]])checkout([$class: 'GitSCM', branches: [[name: env.GERRIT_BRANCH]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${relative_dir}"], [$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]], submoduleCfg: [], userRemoteConfigs: [[refspec: env.GERRIT_REFSPEC, url: "${repo_url}"]]])
2、pipeline启动一个job,build
build job: 'my_job', parameters: [string(name: 'name', value: liurizhou), string(name: 'age', value: 12)],propagate: false,wait: false
用法:
3、发布报告,publishHTML
publishHTML (target: [ allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'info', reportFiles: 'manifest.html, report.html', reportName: "Summary Report"])
用法:
4、withDockerContainer ,pipeline中启动docker镜像运行
withDockerContainer(args: '-e "http_proxy=xxxxx" -e "https_proxy=yyyyyy" -v "/home/my/workspace:/home/my/workspace"', image: 'myimages:latest') { sh "cd /home/my/workspace && ls -l"}
用法:
5、emailext, pipeline中实现邮件发送
emailext ( subject:"标题", body:""" 正文 """, to:"xxxx@126.com" )
用法: