Created
July 2, 2020 21:30
-
-
Save Rahulsharma0810/1f6f4168d13b9fdd1c690e3705b4c88d to your computer and use it in GitHub Desktop.
Jenkins stage to get grep text on http endpoint
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
import groovy.io.FileType | |
/* groovylint-disable-next-line CompileStatic */ | |
pipeline { | |
agent { | |
label '' | |
} | |
stages { | |
stage('1') { | |
steps { | |
timeout(time: 60, unit: 'MINUTES') { | |
script { | |
waitUntil { | |
sleep(60) | |
def VM_STATUS = sh script: """curl -s -X GET http://192.168.0.13/json | jq -r '.status'""", returnStdout: true | |
if (VM_STATUS.trim() == 'SUCCESSFUL' ) { | |
echo "Returned True, Got ${VM_STATUS}" | |
return true | |
} else { | |
echo "Retuned False,Got ${VM_STATUS}" | |
return false | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment