diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 24e2f9b18704648c1df8eefe97b67d430a2b7cb8..81714c18c71e7f7aa193cbb116fca14f1e6e8928 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -580,8 +580,16 @@ class Containerize(): lPassWord = self.eNB2Password lSsh.open(lIpAddr, lUserName, lPassWord) lSsh.command('docker save ' + self.imageToCopy + ':' + imageTag + ' | gzip --fast > ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60) - lSsh.copyin(lIpAddr, lUserName, lPassWord, '~/' + self.imageToCopy + '-' + imageTag + '.tar.gz', '.') + ret = lSsh.copyin(lIpAddr, lUserName, lPassWord, '~/' + self.imageToCopy + '-' + imageTag + '.tar.gz', '.') + if ret != 0: + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) + self.exitStatus = 1 + return False lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60) + if lSsh.getBefore().count('cannot remove'): + HTML.CreateHtmlTestRow('file not created by docker save', 'KO', CONST.ALL_PROCESSES_OK) + self.exitStatus = 1 + return False lSsh.close() # Going to the Test Server @@ -599,15 +607,26 @@ class Containerize(): lPassWord = self.eNB2Password lSsh.open(lIpAddr, lUserName, lPassWord) lSsh.copyout(lIpAddr, lUserName, lPassWord, './' + self.imageToCopy + '-' + imageTag + '.tar.gz', '~') + # copyout has no return code and will quit if something fails lSsh.command('docker rmi ' + self.imageToCopy + ':' + imageTag, '\$', 10) lSsh.command('docker load < ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60) + if lSsh.getBefore().count('o such file') or lSsh.getBefore().count('invalid tar header'): + logging.debug(lSsh.getBefore()) + HTML.CreateHtmlTestRow('problem during docker load', 'KO', CONST.ALL_PROCESSES_OK) + self.exitStatus = 1 + return False lSsh.command('rm ' + self.imageToCopy + '-' + imageTag + '.tar.gz', '\$', 60) + if lSsh.getBefore().count('cannot remove'): + HTML.CreateHtmlTestRow('file not copied during scp?', 'KO', CONST.ALL_PROCESSES_OK) + self.exitStatus = 1 + return False lSsh.close() if os.path.isfile('./' + self.imageToCopy + '-' + imageTag + '.tar.gz'): os.remove('./' + self.imageToCopy + '-' + imageTag + '.tar.gz') HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + return True def DeployObject(self, HTML, EPC): if self.eNB_serverId[self.eNB_instance] == '0': diff --git a/ci-scripts/main.py b/ci-scripts/main.py index baed6a6011981f13d8f1885c78065836cb8967f1..8a4b59ede650e662ddf40a857f7b1769957eea0f 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -921,7 +921,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re elif action == 'Build_Proxy': CONTAINERS.BuildProxy(HTML) elif action == 'Copy_Image_to_Test': - CONTAINERS.Copy_Image_to_Test_Server(HTML) + success = CONTAINERS.Copy_Image_to_Test_Server(HTML) + if not success: + RAN.prematureExit = True elif action == 'Deploy_Object': CONTAINERS.DeployObject(HTML, EPC) if CONTAINERS.exitStatus==1: