Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr ci automation #418

Closed
wants to merge 13 commits into from
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

__pycache__/
6 changes: 4 additions & 2 deletions CI_Automation/CloneTestingRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def clone(self):
Utilities.updateStage(self.ciVars.overallSummaryFile, stage='cloneTestRepo',
status='running', result='None', threadLock=self.lock)

self.log.info(f'clone: testIdTestingBranch: {self.testIdTestingBranch}')

# Create the TestBranch folder to hold all testId testing repos
if os.path.exists(self.testBranchFolder) is False:
Utilities.runLinuxCmd(f'mkdir -p {self.testBranchFolder}')
Expand All @@ -41,7 +43,7 @@ def clone(self):
Utilities.runLinuxCmd(f'chmod 770 {self.testIdTestingBranch}')

if self.ciVars.localTestBranch:
Utilities.runLinuxCmd(f'cp -r {self.ciVars.localTestBranch} {self.testIdTestingBranch}', logObj=self.log)
Utilities.runLinuxCmd(f'cp -r {self.ciVars.localTestBranch}/* {self.testIdTestingBranch}', logObj=self.log)
else:
if self.branchName:
cmd = f'git clone --branch {self.branchName} {self.repo} {self.testIdTestingBranch}'
Expand All @@ -62,7 +64,7 @@ def clone(self):
self.log.info('Verify if cloned repo test branch has files in it')
output = Utilities.runLinuxCmd('ls', cwd=self.testIdTestingBranch, logObj=self.log)
if len(output) > 0:
self.log.info('Verified cloned files!')
self.log.info('Verified cloned files')
verified = True
Utilities.updateStage(self.ciVars.overallSummaryFile, stage='cloneTestRepo',
status='completed', result='passed', threadLock=self.lock)
Expand Down
15 changes: 12 additions & 3 deletions CI_Automation/DentCiArgParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def __init__(self, ciVars: object) -> None:
def parse(self):
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-testName', nargs='+', default=None, help='Give a test name to identify your test ID.')
parser.add_argument('-builds', nargs='+', default=None, help='Both ARM and AMD full path URLs for the builds')
parser.add_argument('-builds', nargs='+', default=None, help='Get from Dent website. Both ARM and AMD full path URLs for the builds')
parser.add_argument('-localBuilds', nargs='+', default=None, help='Local path to builds. Both ARM and AMD full path URLs for the builds')
parser.add_argument('-testSuites', nargs='+', default=None, help='The test suite to run')
parser.add_argument('-repo', nargs='+', default=None, help='The repo to clone for testing')
parser.add_argument('-localBranch', nargs='+', default=None, help='Test with a local branch that is already cloned. Provide the path.')
Expand Down Expand Up @@ -73,6 +74,11 @@ def parse(self):
else:
self.ciVars.builds = args.builds

if args.localBuilds is None:
self.ciVars.localBuilds = []
else:
self.ciVars.localBuilds = args.localBuilds

if args.repo is None:
# Default pulling the main branch
self.ciVars.repo = self.ciVars.gitCloneDefaultRepo
Expand All @@ -92,8 +98,12 @@ def parse(self):
localBranch = args.localBranch[0]

self.ciVars.localTestBranch = localBranch
self.ciVars.repo = localBranch
else:
Utilities.sysExit(self.ciVars, f'No such local test branch: {args.localBranch[0]}')
print(f'No such local test branch: {args.localBranch[0]}')
sys.exit(f'No such local test branch: {args.localBranch[0]}')
else:
self.ciVars.localTestBranch = None

if args.tftp is False and args.http is False:
# Default to use http
Expand All @@ -116,7 +126,6 @@ def parse(self):

if args.disableDownloadNewBuilds:
self.ciVars.downloadNewBuilds = False
self.ciVars.builds = []
else:
if args.builds:
self.ciVars.builds = args.builds
Expand Down
191 changes: 125 additions & 66 deletions CI_Automation/DeployDent.py

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions CI_Automation/DeployIxNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
echo 'start the vm'
virsh autostart IxNetwork-930
virsh start IxNetwork-930

Debug:
virsh console IxNetwork-9.30
"""
import os
import time
Expand Down Expand Up @@ -81,11 +84,11 @@ def __init__(self, ixNetworkVMFolder: str, logObj: object) -> None:
def isIxNetworkVMExists(self) -> bool:
vmExists = False

# Attempt to verify up to 5 times. Sometimes, this command
# Attempt to verify up to 5 times. Sometimes this command
# is either delayed or doesn't show anything
for counter in range(0, 5):
output = Utilities.runLinuxCmd('virsh list', logObj=self.log)
self.log.info(f'isNetworkVMExists: output {counter}/5: {output}')
self.log.info(f'isNetworkVMExists: Verifying {counter}/5x: {output}')

if output:
for line in output:
Expand Down
2 changes: 1 addition & 1 deletion CI_Automation/DeployTestContainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def removeAndBuild(self) -> str:
if self.isDockerImagesExists():
Utilities.updateStage(self.overallSummaryFile, stage=stage,
status='completed', result='passed', threadLock=self.lock)
self.sessionLog.info(f'dentContainerTag: {self.dentContainerTag}')
self.sessionLog.info(f'dentContainerTag: {self.ciVars.dockerImageTag}')
return True
else:
errorMsg = 'Dent test docker images not found'
Expand Down
Loading
Loading