pipeline常用插件用法

pipeline 常用插件语句
1、checkout SCM 可以用来下载git仓代码,还可以支持cherry pick 某个patch

checkout([$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

用法:https://jenkins.io/doc/pipeline/steps/git/

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

用法:https://jenkins.io/doc/pipeline/steps/pipeline-build-step/

3、发布报告,publishHTML

publishHTML (target: [
    allowMissing: false,
    alwaysLinkToLastBuild: false,
    keepAll: true,
    reportDir: 'info',
    reportFiles: 'manifest.html, report.html',
    reportName: "Summary Report"
])

用法:https://jenkins.io/doc/pipeline/steps/htmlpublisher/

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"
}

用法:https://jenkins.io/doc/pipeline/steps/docker-workflow/

5、emailext, pipeline中实现邮件发送

emailext (
	subject:"标题",
	body:"""
	正文
	""",
	to:"xxxx@126.com"  
)

用法:https://jenkins.io/doc/pipeline/steps/email-ext/

转载于:https://www.cnblogs.com/liurizhou/p/10321006.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值