Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion that could make it harder for PR owner to go over the code comments when addressing them as they'd have to open them one by one.

On the other hand, as a reviewer I might want to collapse all comments to focus on reading the code and only open comments to see if someone already commented the same thing at the same code location before adding a comment.

self.log.info('Verified cloned files')
verified = True
Utilities.updateStage(self.ciVars.overallSummaryFile, stage='cloneTestRepo',
status='completed', result='passed', threadLock=self.lock)
Expand Down
28 changes: 21 additions & 7 deletions CI_Automation/DentCiArgParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import Utilities
import globalSettings
from re import search

timestamp = Utilities.getTimestamp(includeMillisecond=True).replace(':', '-')

Expand All @@ -23,7 +24,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 All @@ -46,6 +48,7 @@ def parse(self):
else:
self.ciVars.testId = timestamp

self.ciVars.cmdLine: str = ' '.join(sys.argv)
self.ciVars.timestamp: str = timestamp
self.ciVars.testSessionFolder: str = f'{globalSettings.dentTestResultsFolder}/{self.ciVars.testId}'
self.ciVars.testSessionLogsFolder: str = f'{self.ciVars.testSessionFolder}/CI_Logs'
Expand All @@ -57,14 +60,17 @@ def parse(self):
self.ciVars.reportFile: str = f'{self.ciVars.testSessionFolder}/ciTestReport'

if args.testSuites is None:
sys.exit(1, '-testSuites parameter is required with test suites to use for testing')
sys.exit('-testSuites parameter is required with test suites to use for testing')
else:
# Verify for user defined testSuites existence
for eachTestSuite in args.testSuites:
testSuite = eachTestSuite.replace('.yml', '')
testSuiteFile = f'{self.ciVars.testSuiteFolder}/{testSuite}.yml'
if os.path.exists(testSuiteFile) is False:
Utilities.sysExit(self.ciVars, f'No such test suite name found: {eachTestSuite}')
regexMatch = search('.*((hw|vm)/.*)', testSuite)
if regexMatch:
testSuite = regexMatch.group(1)
testSuiteFile = f'{self.ciVars.testSuiteFolder}/{testSuite}.yml'
else:
testSuiteFile = f'{self.ciVars.testSuiteFolder}/{testSuite}.yml'

self.ciVars.testSuites.append(testSuiteFile)

Expand All @@ -73,6 +79,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 +103,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 +131,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
Loading