Skip to content

Catch GitLab outages in org.cms.WN-basic

John Thiltges requested to merge jthiltge/cmssam:web-gitlab-rc into master

In fetch-from-web-GitLab, add --fail flag to curl, giving a a non-zero return code for failed downloads.

When GitLab is down, the SAM test returns CRITICAL, rather than WARNING

Ex. http://wlcg-sam-cms.cern.ch/dashboard/request.py/metricOutput?host=red-gw2.unl.edu&time=2020-01-28T06:07:28Z&metricfqan=org.cms.WN-basic%20(_cms_Role_lcgadmin)

Adding the --fail flag to curl will result in a non-zero return code for failed GitLab requests, and should hopefully sort this out.

Curl examples:

A successful curl returns 0, as expected

$ curl http://t2.unl.edu/hello.txt
hello
$ echo $?
0

With an unsuccessful 404, curl also returns 0

$ curl http://t2.unl.edu/goodbye.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /goodbye.txt was not found on this server.</p>
</body></html>
$ echo $?
0

Adding the --fail flag causes a non-zero return code for the failed attempt

$ curl --fail http://t2.unl.edu/goodbye.txt
curl: (22) The requested URL returned error: 404 Not Found
$ echo $?
22

Merge request reports