Created
November 23, 2015 23:43
-
-
Save martinda/59ed5f0b2e89e802c410 to your computer and use it in GitHub Desktop.
Hang the Jenkins workflow by loading a class with the load step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Content file:///home/martin/git/workflow-job-definition.git/hang.groovy | |
class MyClass implements Serializable { | |
String name | |
MyClass(String name) { | |
this.name = name | |
} | |
String getName() { | |
return "the name is: "+name | |
} | |
private void writeObject(ObjectOutputStream s) { | |
s.defaultWriteObject() | |
s.writeString(name) | |
} | |
private void readObject(ObjectInputStream s) { | |
s.defaultReadObject() | |
name = s.readString(name) | |
} | |
} | |
MyClass createMyClass(String name) { | |
return new MyClass(name) | |
} | |
return this | |
// Content of Jenkins job: | |
// Workflow job: | |
def flow | |
node() { | |
git 'file:///home/martin/git/workflow-job-definition.git' | |
flow = load 'hang.groovy' | |
} | |
def m = flow.createMyClass("Joe") | |
assert m.getName() == "Joe" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment