From: Denis V. Meltsaykin Date: Sun, 31 Jan 2016 07:54:01 +0000 (+0300) Subject: Jenkins' job reliability and 8.0 support X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e9e8a11c04ad28df709113794d2fb06a4e1a97a2;p=tools%2Fsustaining.git Jenkins' job reliability and 8.0 support 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 --- diff --git a/jenkins/build_cluster/build_cluster.py b/jenkins/build_cluster/build_cluster.py index 97d9db9..c5ea5fd 100755 --- a/jenkins/build_cluster/build_cluster.py +++ b/jenkins/build_cluster/build_cluster.py @@ -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)