Skip to content

Instantly share code, notes, and snippets.

@toshke
Created September 22, 2017 05:15
Show Gist options
  • Save toshke/c22e5b924f061cb067ae895accb0da32 to your computer and use it in GitHub Desktop.
Save toshke/c22e5b924f061cb067ae895accb0da32 to your computer and use it in GitHub Desktop.
jenkins declarative pipeline in place sort
@NonCPS
def nonCpsTest() {
def list = [
['CreationDate': '200'],
['CreationDate': '300'],
['CreationDate': '100'],
]
def rval = list.sort true, { it['CreationDate'] }
echo "Rval=$rval"
echo "List=$list"
}
pipeline {
agent any
stages {
stage('default'){
steps {
script {
nonCpsTest()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment