Download presentation
Presentation is loading. Please wait.
Published byLindsey Hampton Modified over 9 years ago
1
Jenkins User Conference Jenkins User Conference San Francisco, Sept 30 2012 #jenkinsconf Take Control. Write a Plugin. Part II Baruch Sadogursky JFrog www.jfrog.com
2
About me Developer Advocate @JFrog Job definition: Write code Talk about it github.com/jbaruch @jbaruch
3
With Jenkins from day 1 Jenkins Artifactory Plugin Hosted JUC Israel repo.jenkins-ci.org JavaOne DEMOzone JFrog & Jenkins
4
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
5
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
6
Who saw “Take Control. Write a Plugin” session on YouTube?“Take Control. Write a Plugin” session on YouTube Let me guess… one or two hands… First, let’s vote
7
PREVIOUSLY IN “TAKE CONTROL. WRITE A PLUGIN”… “Hello, my name is Noam Tenne”
8
What you can do with plugins What you can’t do with plugins Plugins statistics Overview – Why plugins
9
UI SCM Build Processes Slave management Tooling... Many, many, more You can even create new extension points! What can I extend?
10
IDE All majors have good support We love IntelliJ IDEA Build tool Can be Maven or Gradle Environment
11
Target: Rewarding failing builds with insulting mockery Global configuration: Motivation phrase Project configuration: Is motivator enabled Outcome: Message appears in log after failure The “Motivation” Plugin
12
BACK TO OUR AGENDA Nowdays…
13
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
14
Jenkins has remote agents! Working with remote agents
15
Send closures to remote agents hudson.remoting.Callable Working with remote agents Java Serialization
16
Poor guy’s Java closure Usually anonymous inner class (not always) Closure
17
Channel? Cast your bread on the waters
18
Represents a communication channel to the remote peer Obtain from: Channel
19
Where is the file? Distribution Abstractions – FilePath
20
hudson.FilePath Much like java.util.File Consider pushing logic to the file Use FilePath.act(FileCallable) Distribution Abstractions – FilePath
21
Launch stuff remotely! Distribution Abstractions – Launcher
22
hudson.Launcher Much like java.lang.ProcessBuilder Pick your environment variables wisely! Distribution Abstractions – Launcher
23
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
24
WORA. You know. But. / vs \.sh vs. bat Quotes around commands Permissions (wait for it…) Working in multiple OSs
25
Executing file… remotely… platform independent… Running script…
26
Can You Spot The Error? Executed locally!
27
Use FilePath – it will take care of all the details! Execute FilePath.act(FileCallable) If you need the File API, invoke() method has it, converted to remote file properly Going Remote with File
28
Permissions Dance
29
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
30
First, let’s look at the docs: Creating UI using Groovy
31
Analogous to Jelly Can use Jelly tags and libraries Kohsuke: Creating UI using Groovy WhenWhat Lots of program logicGroovy Lots of HTML layout markupJelly
32
Analogous to Jelly Can use Jelly tags and libraries me: Creating UI using Groovy WhenWhat Always!Groovy
33
Jelly: Groovy: Creating UI using Groovy
34
Real code Debuggable, etc. (stay tuned…)
35
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
36
Documentation: Writing custom Jelly(?) tags
39
Simple as 1,2… that’s it. Writing custom Jelly Groovy tags
40
1. Implement
41
2. Use!
42
Vote and guessing Working with remote agents Working in multiple operation systems Creating UI using Groovy Writing custom Jelly(?) tags Maintaining backwards compatibility Agenda
43
Back to Motivation plugin… Maintaining backwards compatibility
44
Rename defaultMotivatingMessage to motivatingMessage What happens to existing configuration on users machines? Refactoring!
45
Register field (or class) alias In Initializer that runs before plugins started More complex cases might reqiure XStream converter XStream Aliasing To The Rescue
46
See you at our DEMOzone! Thank you!
47
Thank You To Our Sponsors
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.