Skip to content

Instantly share code, notes, and snippets.

@martinda
Created November 23, 2015 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinda/59ed5f0b2e89e802c410 to your computer and use it in GitHub Desktop.
Save martinda/59ed5f0b2e89e802c410 to your computer and use it in GitHub Desktop.
Hang the Jenkins workflow by loading a class with the load step
// 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