]> review.fuel-infra Code Review - tools/sustaining.git/commitdiff
Jenkins' job reliability and 8.0 support 77/16577/1
authorDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Sun, 31 Jan 2016 07:54:01 +0000 (10:54 +0300)
committerDenis V. Meltsaykin <dmeltsaykin@mirantis.com>
Sun, 31 Jan 2016 07:59:48 +0000 (10:59 +0300)
As this job is used in jenkins as non-stop job
(i.e. it should be running until aborted), there is a possibility
that executor thread will receive more than one interrupt,
and will generate SIGTERM during the cleanup procedure.
This commit adds some signal ignorance to the cleanup
procedure to have a chance of successful completion if
multiple signals are arriving.

Also, the work on 8.0+ support is started.

Change-Id: If78b896b15d87f560d7d26d4da5becfc757658ef

jenkins/build_cluster/build_cluster.py

index 97d9db93eebf35d1884c5668ab8ebfe69ae012fd..c5ea5fd5285eca41b2a9a7d61e103544adcfb055 100755 (executable)
@@ -2,6 +2,7 @@
 
 import os
 import re
+import signal
 import subprocess
 import sys
 import time
@@ -44,6 +45,12 @@ if cfg["ISO_URL"]:
     cfg["ISO_PATH"] = cfg["ISO_DIR"] + cfg["ISO_URL"] \
         .split("/")[-1].split(".torrent")[0]
 
+# new releases such as 8.0 and 9.0 use new interface naming scheme
+# e.g. 'enp0s4' instead of 'eth1' so we should get version of Fuel from ISO name
+
+new_versions = ["8.0", "9.0"]
+is_new = any(v in cfg["ISO_URL"] for v in new_versions)
+
 cfg["PREPARE_CLUSTER"] = os.getenv("PREPARE_CLUSTER")
 cfg["RELEASE"] = os.getenv("RELEASE")
 cfg["HA"] = os.getenv("HA")
@@ -599,9 +606,15 @@ def main():
     unique BUILD_NUMBER
     """
     if '--destroy' in sys.argv:
+        # ignore SIGTERM & SIGINT to have a chance to make cleanup
+        # uninterrupted in case if multiple signals are coming
+        signal.signal(signal.SIGINT, signal.SIG_IGN)
+        signal.signal(signal.SIGTERM, signal.SIG_IGN)
+
         print("Destroying {0}".format(cfg["ENV_NAME"]))
         cleanup()
         sys.exit(0)
+
     print("Starting script with the following options:\n")
     pprint_dict(cfg)