Created
June 25, 2019 15:13
-
-
Save ranrubin/4964fc7d1fa7ff47caf6e50890db091c to your computer and use it in GitHub Desktop.
This file contains 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
@Library('Jenkins-Shared-Library-Objects@stateful-advanced') | |
def httpHandler = getHttpRestHandler("http://myconsul.com:8500") // constructing a HttpRest | |
def consul = getConsulHandler(httpHandler) | |
node('NODE') { | |
try { | |
String jsonRegisterData = "{ .. }" // A string of whatever data we want in json format | |
stage("register data") { | |
consul.register(jsonRegisterData) | |
} | |
stage("store some data") { | |
consul.store("v1/kv/test/1/data", "value1") | |
consul.store("v1/kv/test/2/data", "value2") | |
} | |
stage("list Nodes"){ | |
consul.list_nodes() | |
} | |
} | |
catch(err){ | |
//.. handle | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment