summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/ci.py22
-rw-r--r--lib/spack/spack/cmd/ci.py18
2 files changed, 22 insertions, 18 deletions
diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py
index edcca7f2ed..f23445f1df 100644
--- a/lib/spack/spack/ci.py
+++ b/lib/spack/spack/ci.py
@@ -1271,6 +1271,7 @@ def get_concrete_specs(env, root_spec, job_name, related_builds,
def register_cdash_build(build_name, base_url, project, site, track):
url = base_url + '/api/v1/addBuild.php'
time_stamp = datetime.datetime.now().strftime('%Y%m%d-%H%M')
+ build_id = None
build_stamp = '{0}-{1}'.format(time_stamp, track)
payload = {
"project": project,
@@ -1292,17 +1293,20 @@ def register_cdash_build(build_name, base_url, project, site, track):
request = Request(url, data=enc_data, headers=headers)
- response = opener.open(request)
- response_code = response.getcode()
+ try:
+ response = opener.open(request)
+ response_code = response.getcode()
- if response_code != 200 and response_code != 201:
- msg = 'Adding build failed (response code = {0}'.format(response_code)
- tty.warn(msg)
- return (None, None)
+ if response_code != 200 and response_code != 201:
+ msg = 'Adding build failed (response code = {0}'.format(response_code)
+ tty.warn(msg)
+ return (None, None)
- response_text = response.read()
- response_json = json.loads(response_text)
- build_id = response_json['buildid']
+ response_text = response.read()
+ response_json = json.loads(response_text)
+ build_id = response_json['buildid']
+ except Exception as e:
+ print("Registering build in CDash failed: {0}".format(e))
return (build_id, build_stamp)
diff --git a/lib/spack/spack/cmd/ci.py b/lib/spack/spack/cmd/ci.py
index 4c2ee5f25d..c0df5a2f40 100644
--- a/lib/spack/spack/cmd/ci.py
+++ b/lib/spack/spack/cmd/ci.py
@@ -437,17 +437,17 @@ def ci_rebuild(args):
cdash_build_name, cdash_base_url, cdash_project,
cdash_site, job_spec_buildgroup)
- if cdash_build_id is not None:
- cdash_upload_url = '{0}/submit.php?project={1}'.format(
- cdash_base_url, cdash_project_enc)
+ cdash_upload_url = '{0}/submit.php?project={1}'.format(
+ cdash_base_url, cdash_project_enc)
- install_args.extend([
- '--cdash-upload-url', cdash_upload_url,
- '--cdash-build', cdash_build_name,
- '--cdash-site', cdash_site,
- '--cdash-buildstamp', cdash_build_stamp,
- ])
+ install_args.extend([
+ '--cdash-upload-url', cdash_upload_url,
+ '--cdash-build', cdash_build_name,
+ '--cdash-site', cdash_site,
+ '--cdash-buildstamp', cdash_build_stamp,
+ ])
+ if cdash_build_id is not None:
tty.debug('CDash: Relating build with dependency builds')
spack_ci.relate_cdash_builds(
spec_map, cdash_base_url, cdash_build_id, cdash_project,