ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
1
2
3
4
Jenkins.instance.doQuietDown()
Jenkins.instance.numExecutors	=	5
Jenkins.instance.slaveAgentPort	=	[55000]
def	global_domain	=	Domain.global()
def	credentials_store	=	Jenkins.instance.getExtensionList(
				'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)[0].store
def	credentials	=	new	BasicSSHUserPrivateKey(	CredentialsScope.GLOBAL,	null,
				"root",	new	BasicSSHUserPrivateKey.UsersPrivateKeySource(),	"",	"")
credentials_store.addCredentials(global_domain,	credentials)
5
java	-jar	jenkins-cli.jar	[-s	JENKINS_URL]	command	[options¡­? ]	[arguments¡­? ]
java	-jar	jenkins-cli.jar	-s	 	groovy	somescript.groovy
java	-jar	jenkins-cli.jar	-s	 	groovysh
http://jenkins
http://jenkins
6
import	hudson.plugins.chucknorris.CordellWalkerRecorder
for(item	in	Jenkins.instance.items)	{
					item.publishersList.replace(	new	CordellWalkerRecorder()	)
}
disableChildren(Hudson.instance.items)
def	disableChildren(items)	{
		for	(item	in	items)	{
				if	(item.class.canonicalName	!=
																												'com.cloudbees.hudson.plugins.folder.Folder')	{
	 		if	(	m	=	item.name	=~	/^(Hudson_)(..*)$/	)
										item.renameTo('Jenkins_'	+	m.group(2))
				}	else	disableChildren(item.items)
		}
}
7
?
$	curl	--data-urlencode	"script=$(<./somescript.groovy)"	
$	curl	--user	'username:password'	.	.	.
http://jenkins/scriptText
8
?
9
10
? ?
11
?
12
?
13
?
14
?
15
16
?
17
?
node	{
				//	Mark	the	code	checkout	'stage'....
				stage	'Checkout'
				//	Get	some	code	from	a	GitHub	repository
				git	url:	'https://github.com/jglick/simple-maven-project-with-tests.git'
				//	Get	the	maven	tool.
				//	This	'M3'	maven	tool	must	be	configured	in	the	global	configuration
				def	mvnHome	=	tool	'M3'
				stage	'Build'
				//	Run	the	maven	build
				sh	"${mvnHome}/bin/mvn	clean	install"
}
18
19
?
20
def	project	=	'quidryan/aws-sdk-test'
def	branchApi	=	new	URL("https://api.github.com/repos/${project}/branches")
def	branches	=	new	groovy.json.JsonSlurper().parse(branchApi.newReader())
branches.each	{
				def	branchName	=	it.name
				def	jobName	=	"${project}-${branchName}".replaceAll('/','-')
				job(jobName)	{
								scm	{
												git("git://github.com/${project}.git",	branchName)
								}
								steps	{
												maven("test	-Dproject.name=${project}/${branchName}")
								}
				}
}
21
22
def	labelMap	=	[	arm:	"armcc",	win:	"vs2010",	linux:	"gcc"	]
return	labelMap."${binding.variables.platform}"
23
?
24
25
? ?
26
27
? ?
28
?
29
import	groovyx.remote.client.RemoteControl
import	groovyx.remote.transport.http.HttpTransport
def	transport	=	new	HttpTransport("http://myJenkins/plugin/groovy-remote")
def	remote	=	new	RemoteControl(transport)
//	This	code	runs	on	local.
def	name	=	'kiy0taka'
println	name
def	result	=	remote	{
				//	This	closure	runs	on	Jenkins	server.
				def	version	=	jenkins.version.value
				println	"Hi,	${name}!"
				//	Return	Jenkins	version.
				return	version
}
//	This	code	runs	on	local.
println	"Jenkins	version	was	${result}."
30
31
? ?
32
?
33
def	authors	=	"[hidden	email]"
if	(build.environment["RELEASE_BUILD"])	{
				authors	=	build.environment["RELEASE_BUILD_EMAIL_DISTRIBUTION"]
}
return	authors
34
build	result	is	${build.result}
build	url	is	${rooturl}${build.url}
<%	def	changeSet	=	build.changeSet
if(changeSet	!=	null)	{
				def	hadChanges	=	false
				changeSet.each()	{	cs	->
	 hadChanges	=	true
	 def	aUser	=	cs.author	%>
Revision:	(${aUser.displayName})	${cs.msgAnnotated}
<%	 cs.affectedFiles.each()	{	p	->	%>
${p.editType.name},${p.path}
<%						}
				}
				if(!hadChanges)	{
%>
No	Changes
<%		}
}	%>
35
36
Ad

Recommended

What happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
Jace Ju
?
An Introduction to Celery
An Introduction to Celery
Idan Gazit
?
Node.js API ?? ?? ???
Node.js API ?? ?? ???
JeongHun Byeon
?
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
?
§£§Ó§Ö§Õ§Ö§ß§Ú§Ö §Ó REST API
§£§Ó§Ö§Õ§Ö§ß§Ú§Ö §Ó REST API
Oleg Zinchenko
?
Custom deployments with sbt-native-packager
Custom deployments with sbt-native-packager
GaryCoady
?
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
?
Django Celery
Django Celery
Mat Clayton
?
Ansible tips & tricks
Ansible tips & tricks
bcoca
?
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
Walter Heck
?
Europython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & Celery
Mauro Rocco
?
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
tanacasino
?
10 Useful Asciidoctor Tips
10 Useful Asciidoctor Tips
Andres Almiray
?
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
YoungHeon (Roy) Kim
?
Hacking ansible
Hacking ansible
bcoca
?
Continuous Integration with Robot Sweatshop
Continuous Integration with Robot Sweatshop
Justin Scott
?
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus L?nnberg
?
Node.js - A Quick Tour
Node.js - A Quick Tour
Felix Geisend?rfer
?
How Secure Are Docker Containers?
How Secure Are Docker Containers?
Ben Hall
?
Web Crawling with NodeJS
Web Crawling with NodeJS
Sylvain Zimmer
?
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
Mark Hemmings
?
Py conkr 20150829_docker-python
Py conkr 20150829_docker-python
Eric Ahn
?
Working with AFNetworking
Working with AFNetworking
waynehartman
?
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
Corneil du Plessis
?
Intro to-ant
Intro to-ant
Manav Prasad
?
Ant
Ant
Manav Prasad
?
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Innovecs
?
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
Felix Geisend?rfer
?
DSL101
DSL101
sascha_klein
?
Groovy on the shell
Groovy on the shell
sascha_klein
?

More Related Content

What's hot (20)

Ansible tips & tricks
Ansible tips & tricks
bcoca
?
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
Walter Heck
?
Europython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & Celery
Mauro Rocco
?
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
tanacasino
?
10 Useful Asciidoctor Tips
10 Useful Asciidoctor Tips
Andres Almiray
?
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
YoungHeon (Roy) Kim
?
Hacking ansible
Hacking ansible
bcoca
?
Continuous Integration with Robot Sweatshop
Continuous Integration with Robot Sweatshop
Justin Scott
?
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus L?nnberg
?
Node.js - A Quick Tour
Node.js - A Quick Tour
Felix Geisend?rfer
?
How Secure Are Docker Containers?
How Secure Are Docker Containers?
Ben Hall
?
Web Crawling with NodeJS
Web Crawling with NodeJS
Sylvain Zimmer
?
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
Mark Hemmings
?
Py conkr 20150829_docker-python
Py conkr 20150829_docker-python
Eric Ahn
?
Working with AFNetworking
Working with AFNetworking
waynehartman
?
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
Corneil du Plessis
?
Intro to-ant
Intro to-ant
Manav Prasad
?
Ant
Ant
Manav Prasad
?
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Innovecs
?
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
Felix Geisend?rfer
?
Ansible tips & tricks
Ansible tips & tricks
bcoca
?
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
Walter Heck
?
Europython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & Celery
Mauro Rocco
?
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
¤³¤ï¤¯¤Ê¤¤¤è?? Playframework¥½©`¥¹¥³©`¥É¥ê©`¥Ç¥£¥ó¥°ÈëéT
tanacasino
?
10 Useful Asciidoctor Tips
10 Useful Asciidoctor Tips
Andres Almiray
?
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
YoungHeon (Roy) Kim
?
Hacking ansible
Hacking ansible
bcoca
?
Continuous Integration with Robot Sweatshop
Continuous Integration with Robot Sweatshop
Justin Scott
?
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
Marcus L?nnberg
?
How Secure Are Docker Containers?
How Secure Are Docker Containers?
Ben Hall
?
MySQL in Go - Golang NE July 2015
MySQL in Go - Golang NE July 2015
Mark Hemmings
?
Py conkr 20150829_docker-python
Py conkr 20150829_docker-python
Eric Ahn
?
Working with AFNetworking
Working with AFNetworking
waynehartman
?
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
Corneil du Plessis
?
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
Innovecs
?

More from sascha_klein (10)

DSL101
DSL101
sascha_klein
?
Groovy on the shell
Groovy on the shell
sascha_klein
?
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017
sascha_klein
?
Bob the Builder - Gr8Conf EU 2017
Bob the Builder - Gr8Conf EU 2017
sascha_klein
?
GroovyFX - Groove JavaFX
GroovyFX - Groove JavaFX
sascha_klein
?
Introduction to Graphics- and UI-Design
Introduction to Graphics- and UI-Design
sascha_klein
?
Android on Groovy
Android on Groovy
sascha_klein
?
Groovy on the shell
Groovy on the shell
sascha_klein
?
Groovy on the Shell
Groovy on the Shell
sascha_klein
?
Vert.x using Groovy - Simplifying non-blocking code
Vert.x using Groovy - Simplifying non-blocking code
sascha_klein
?
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017
sascha_klein
?
Bob the Builder - Gr8Conf EU 2017
Bob the Builder - Gr8Conf EU 2017
sascha_klein
?
GroovyFX - Groove JavaFX
GroovyFX - Groove JavaFX
sascha_klein
?
Introduction to Graphics- and UI-Design
Introduction to Graphics- and UI-Design
sascha_klein
?
Vert.x using Groovy - Simplifying non-blocking code
Vert.x using Groovy - Simplifying non-blocking code
sascha_klein
?
Ad

Recently uploaded (20)

How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
?
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
?
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
?
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
?
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
?
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
?
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
?
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
?
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
?
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
?
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
?
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
?
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
?
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Philip Schwarz
?
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
?
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
?
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
?
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
?
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
?
University Campus Navigation for All - Peak of Data & AI
University Campus Navigation for All - Peak of Data & AI
Safe Software
?
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
?
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
?
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
?
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
IDM Crack with Internet Download Manager 6.42 Build 41 [Latest 2025]
pcprocore
?
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
ERP Systems in the UAE: Driving Business Transformation with Smart Solutions
dheeodoo
?
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
CodeCleaner: Mitigating Data Contamination for LLM Benchmarking
arabelatso
?
HYBRIDIZATION OF ALKANES AND ALKENES ...
HYBRIDIZATION OF ALKANES AND ALKENES ...
karishmaduhijod1
?
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
?
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
?
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
?
Azure AI Foundry: The AI app and agent factory
Azure AI Foundry: The AI app and agent factory
Maxim Salnikov
?
Humans vs AI Call Agents - Qcall.ai's Special Report
Humans vs AI Call Agents - Qcall.ai's Special Report
Udit Goenka
?
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
?
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Folding Cheat Sheet # 9 - List Unfolding ?????? as the Computational Dual of ...
Philip Schwarz
?
Best Practice for LLM Serving in the Cloud
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
?
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
?
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
?
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
?
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
?
University Campus Navigation for All - Peak of Data & AI
University Campus Navigation for All - Peak of Data & AI
Safe Software
?
Ad

Using Groovy with Jenkins