On Thursday, March 31, 2022 at 9:37:40 AM UTC-6 misteek wrote: > Hi all, > > New to jenkinsfile/groovy world. > > Can someone please let me know how to create a jenkins pipeline health > check to check if multiple websites are running. > > If any of the sites are down or http response code is not 200 an email > notification should be sent. > > For every website to be checked should I create separate "stages" in the > pipeline or is there a better way? >
I think that what you're describing is a "test" to confirm the web sites are running. One way to implement that is to create the web site checker as tests that output their results in JUnit format, then use the JUnit plugin to display the results in Jenkins. That allows you to run the tests outside Jenkins and see multiple results inside Jenkins. For example, you could write the test in Python and output the result to a junit format with as described https://stackoverflow.com/questions/11241781/python-unittests-in-jenkins Another example, you could write the test in Javascript with jest, as described in https://stackoverflow.com/questions/54294612/how-to-publish-jest-test-results-in-jenkins You could write the test in Java and output the result to junit format as done in the tutrorial https://www.jenkins.io/doc/tutorials/build-a-java-app-with-maven/#add-a-test-stage-to-your-pipeline Each of those techniques have the benefit that you write the test locally, run it locally, then use Jenkins to execute the same test as you run locally. Mark Waite -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9c68d983-688f-4a8d-a191-ca22d386ffb5n%40googlegroups.com.
