Skip to content

Commit

Permalink
Fixed stage result settings
Browse files Browse the repository at this point in the history
Signed-off-by: hubogee <[email protected]>
  • Loading branch information
hubogee committed Jul 15, 2024
1 parent 7940a88 commit 920d99d
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions CI_Automation/runDentCi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3

"""
version = v10
version = v11
Dent CI Automation Framework
Expand Down Expand Up @@ -591,8 +591,11 @@ def downloadBuilds(self):
STAGE 1: Download Dent build image to tftp server /srv/tftp
"""
if self.ciVars.downloadNewBuilds is False:
self.stage1Result = 'failed'
return
if self.stage1Result != 'failed':
self.stage1Result = 'passed'
return
else:
return

downloadBuildsResults = downloadBuilds(self.ciVars)
if downloadBuildsResults is False:
Expand All @@ -607,9 +610,16 @@ def installDentOS(self, stage='installDentOS'):
"""
STAGE 2: Install build on Dent
"""
if self.stage1Result == 'failed' or self.ciVars.installDentOS is False:
if self.stage1Result == 'failed':
return

if self.ciVars.installDentOS is False:
if self.stage2Result != 'failed':
self.stage2Result = 'passed'
return
else:
return

# Requires pulling the branch for testbed configs
self.isTestIdTestBranchExists(stage=stage)
updateDentResult = updateDent(self.ciVars)
Expand All @@ -632,9 +642,15 @@ def deployIxNetwork(self, forceBringUp=False):
"""
STAGE 2: Deploy IxNetwork
"""
if self.stage1Result != 'failed' and self.ciVars.deployIxNetwork is False and forceBringUp is False:
if self.stage1Result == 'failed':
return

if forceBringUp is False:
if self.ciVars.deployIxNetwork is False:
if self.stage2Result != 'failed':
self.stage2Result = 'passed'
return

deployIxNetworkResult = deployIxNetworkInit(ciVars=self.ciVars)
if deployIxNetworkResult is False:
self.stage2Result = 'failed'
Expand All @@ -655,9 +671,14 @@ def deployDentTestContainers(self):
"""
STAGE 2: Deploy test containers
"""
if self.stage2Result != 'failed' or self.ciVars.deployDentTestContainers is False:
if self.stage1Result == 'failed':
return

if self.ciVars.deployDentTestContainers is False:
if self.stage2Result != 'failed':
self.stage2Result = 'passed'
return

dentContainerObj = DeployTestContainers(self.ciVars.testContainersLogFile, self.ciVars)
result = dentContainerObj.removeAndBuild()

Expand All @@ -674,7 +695,10 @@ def runTest(self, stage='runTest'):
"""
STAGE 3: Run test
"""
if self.stage2Result != 'failed' or self.ciVars.runTest is False:
if self.stage2Result == 'failed':
return

if self.ciVars.runTest is False:
return

# Verify if test branch exists
Expand Down Expand Up @@ -722,6 +746,7 @@ def runTest(self, stage='runTest'):
if threads:
Utilities.runThreads(ciVars, threads)

ciVars.sessionLog.info(f'Stage 1 result: {ci.stage1Result}')
# Stage 2
if ci.stage1Result == 'passed':
threads = []
Expand All @@ -741,6 +766,7 @@ def runTest(self, stage='runTest'):
raise Exception('Stage 1 failed. Aborting test.')

# Stage 3
ciVars.sessionLog.info(f'Stage 2 result: {ci.stage2Result}')
if ci.stage2Result == 'passed':
if ciVars.runTest:
ci.runTest()
Expand Down

0 comments on commit 920d99d

Please sign in to comment.