summary refs log tree commit diff stats
path: root/scripts/ci
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-03-10 17:22:45 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-03-10 17:22:45 +0000
commit821e7ed167f11f482d2d1a8eaf114a667295a581 (patch)
tree0129168d8340a3aed46ed4803ac83eec0fafea86 /scripts/ci
parent5c6295a45b4fceac913c11abc62488c49c02b9fd (diff)
parent65a9d3807e9a0ffd9f9719416a07be41b6f39e94 (diff)
downloadfocaccia-qemu-821e7ed167f11f482d2d1a8eaf114a667295a581.tar.gz
focaccia-qemu-821e7ed167f11f482d2d1a8eaf114a667295a581.zip
Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-03-09' into staging
* Add some missing gitlab-CI job dependencies
* Re-enable "make check SPEED=slow"
* Improve the gitlab-pipeline-status script
* Clean up inclusing of qtest.h headers
* Improve libqos/qgraph documentation
* Fix downloading problem in the acceptance tests
* Remove deprecated target tilegx
* Add new bsd-user maintainers

# gpg: Signature made Tue 09 Mar 2021 10:27:29 GMT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/thuth-gitlab/tags/pull-request-2021-03-09:
  bsd-user: Add new maintainers
  Remove deprecated target tilegx
  Acceptance Tests: restore filtering of tests by target arch
  Acceptance Tests: restore downloading of VM images
  docs/devel/qgraph: improve qgraph documentation
  libqos/qgraph: format qgraph comments for sphinx documentation
  scripts/ci/gitlab-pipeline-status: give more info when pipeline not found
  scripts/ci/gitlab-pipeline-status: give more information on failures
  scripts/ci/gitlab-pipeline-status: split utlity function for HTTP GET
  meson: Re-enable the possibility to run "make check SPEED=slow"
  docker: OpenSBI build job depends on OpenSBI container
  docker: EDK2 build job depends on EDK2 container
  docker: Alpine build job depends on Alpine container
  qtest: delete superfluous inclusions of qtest.h

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/ci')
-rwxr-xr-xscripts/ci/gitlab-pipeline-status25
1 files changed, 18 insertions, 7 deletions
diff --git a/scripts/ci/gitlab-pipeline-status b/scripts/ci/gitlab-pipeline-status
index 78e72f6008..924db327ff 100755
--- a/scripts/ci/gitlab-pipeline-status
+++ b/scripts/ci/gitlab-pipeline-status
@@ -48,24 +48,35 @@ def get_local_branch_commit(branch):
     return result
 
 
-def get_pipeline_status(project_id, commit_sha1):
+def get_json_http_response(url):
     """
-    Returns the JSON content of the pipeline status API response
+    Returns the JSON content of an HTTP GET request to gitlab.com
     """
-    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
-                                                        commit_sha1)
     connection = http.client.HTTPSConnection('gitlab.com')
     connection.request('GET', url=url)
     response = connection.getresponse()
     if response.code != http.HTTPStatus.OK:
-        raise CommunicationFailure("Failed to receive a successful response")
-    json_response = json.loads(response.read())
+        msg = "Received unsuccessful response: %s (%s)" % (response.code,
+                                                           response.reason)
+        raise CommunicationFailure(msg)
+    return json.loads(response.read())
+
+
+def get_pipeline_status(project_id, commit_sha1):
+    """
+    Returns the JSON content of the pipeline status API response
+    """
+    url = '/api/v4/projects/{}/pipelines?sha={}'.format(project_id,
+                                                        commit_sha1)
+    json_response = get_json_http_response(url)
 
     # As far as I can tell, there should be only one pipeline for the same
     # project + commit. If this assumption is false, we can add further
     # filters to the url, such as username, and order_by.
     if not json_response:
-        raise NoPipelineFound("No pipeline found")
+        msg = "No pipeline found for project %s and commit %s" % (project_id,
+                                                                  commit_sha1)
+        raise NoPipelineFound(msg)
     return json_response[0]