Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save visitbethel/a009e8ac15793567e212545dd58b46d0 to your computer and use it in GitHub Desktop.
Save visitbethel/a009e8ac15793567e212545dd58b46d0 to your computer and use it in GitHub Desktop.
Jenksin Pipeline JSON Config Slurp to Avoid Serializable
import groovy.json.JsonSlurperClassic
@NonCPS
def jsonParse(def json) {
new groovy.json.JsonSlurperClassic().parseText(json)
}
node('master') {
def config = jsonParse(readFile("config.json"))
def db = config["database"]["address"]
...
}
#NOTE : JsonSlurperClassic needs to be approved for usage...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment