Reputation: 1
I tried getting the versions using getApplicationProcessRequest, however it only gives you all the version in Application Process if the Process is successful in component process, else It would not give the Version Names.
Any help is appreciated. Kindly help I need it to implement in my Project.
Upvotes: 0
Views: 893
Reputation: 24453
If I understood the question correctly, you can get information about an application process requests on the server by using getApplicationsProcessRequests CLI command:
def getInformation(application, startedAfter) {
def allRequests = ucdCliCommands.getInformationAboutAllApplicationProcessRequestsOnServer(startedAfter)
def applicationProcessRequests = jsonUtils.parseTextIntoHashMap(allRequests)
.findAll { it.application.name == application }
.collect { it -> it.application.name + ': ' + it.snapshot.name }
echo "Application Process Requests:\n$applicationProcessRequests"
}
First we get information about all application process requests, then parse a text representation of a JSON response, then filter by the UCD application name and then collect, for example application name with snapshot name, into a list.
ucdCliCommands.groovy:
/**
* Get information about all application process requests on the server
*
* https://www.ibm.com/docs/en/urbancode-deploy/7.1.1?topic=commands-getapplicationsprocessrequests
*/
def getInformationAboutAllApplicationProcessRequestsOnServer(startedAfter) {
echo 'Getting information about all application process requests on the server'
command = 'getApplicationsProcessRequests'
if (startedAfter.empty) {
runCliCommandWithAuthTokenAndWebUrl(command)
} else {
parameters = "-startedAfter '${startedAfter}'"
runCliCommandWithAuthTokenAndWebUrl(command, parameters)
}
}
jsonUtils.groovy:
def parseTextIntoHashMap(text) {
new JsonSlurperClassic().parseText(text)
}
Upvotes: 0