Use archiveArtifact() for LicenceAndFormattingCheck()
This commit is contained in:
@@ -43,6 +43,7 @@ from pathlib import Path
|
|||||||
import helpreadme as HELP
|
import helpreadme as HELP
|
||||||
import constants as CONST
|
import constants as CONST
|
||||||
import cls_cmd
|
import cls_cmd
|
||||||
|
from cls_ci_helper import archiveArtifact
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
# Class Declaration
|
# Class Declaration
|
||||||
@@ -213,7 +214,7 @@ class StaticCodeAnalysis():
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def LicenceAndFormattingCheck(self, HTML):
|
def LicenceAndFormattingCheck(self, ctx, HTML):
|
||||||
# Workspace is no longer recreated from scratch.
|
# Workspace is no longer recreated from scratch.
|
||||||
# It implies that this method shall be called last within a build pipeline
|
# It implies that this method shall be called last within a build pipeline
|
||||||
# where workspace is already created
|
# where workspace is already created
|
||||||
@@ -238,7 +239,7 @@ class StaticCodeAnalysis():
|
|||||||
else:
|
else:
|
||||||
check_options += f' --build-arg TARGET_BRANCH={self.ranTargetBranch}'
|
check_options += f' --build-arg TARGET_BRANCH={self.ranTargetBranch}'
|
||||||
|
|
||||||
logDir = f'{lSourcePath}/cmake_targets/build_log_{self.testCase_id}'
|
logDir = f'{lSourcePath}/cmake_targets/log/'
|
||||||
cmd.run(f'mkdir -p {logDir}')
|
cmd.run(f'mkdir -p {logDir}')
|
||||||
cmd.run('docker image rm oai-formatting-check:latest')
|
cmd.run('docker image rm oai-formatting-check:latest')
|
||||||
cmd.run(f'docker build --target oai-formatting-check --tag oai-formatting-check:latest {check_options} --file {lSourcePath}/ci-scripts/docker/Dockerfile.formatting.bionic {lSourcePath} > {logDir}/oai-formatting-check.txt 2>&1')
|
cmd.run(f'docker build --target oai-formatting-check --tag oai-formatting-check:latest {check_options} --file {lSourcePath}/ci-scripts/docker/Dockerfile.formatting.bionic {lSourcePath} > {logDir}/oai-formatting-check.txt 2>&1')
|
||||||
@@ -247,12 +248,11 @@ class StaticCodeAnalysis():
|
|||||||
cmd.run('docker image prune --force')
|
cmd.run('docker image prune --force')
|
||||||
cmd.run('docker volume prune --force')
|
cmd.run('docker volume prune --force')
|
||||||
|
|
||||||
# Analyzing the logs
|
file = archiveArtifact(cmd, ctx, f'{logDir}/oai-formatting-check.txt')
|
||||||
cmd.copyin(f'{logDir}/oai-formatting-check.txt', 'oai-formatting-check.txt')
|
|
||||||
cmd.close()
|
cmd.close()
|
||||||
|
|
||||||
finalStatus = 0
|
finalStatus = 0
|
||||||
if (os.path.isfile('./oai-formatting-check.txt')):
|
if (os.path.isfile(file)):
|
||||||
analyzed = False
|
analyzed = False
|
||||||
nbFilesNotFormatted = 0
|
nbFilesNotFormatted = 0
|
||||||
listFiles = False
|
listFiles = False
|
||||||
@@ -263,7 +263,7 @@ class StaticCodeAnalysis():
|
|||||||
gnuGplLicenceFiles = []
|
gnuGplLicenceFiles = []
|
||||||
suspectLicence = False
|
suspectLicence = False
|
||||||
suspectLicenceFiles = []
|
suspectLicenceFiles = []
|
||||||
with open('./oai-formatting-check.txt', 'r') as logfile:
|
with open(file, 'r') as logfile:
|
||||||
for line in logfile:
|
for line in logfile:
|
||||||
ret = re.search('./ci-scripts/checkCodingFormattingRules.sh', str(line))
|
ret = re.search('./ci-scripts/checkCodingFormattingRules.sh', str(line))
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
|
|||||||
+1
-1
@@ -346,7 +346,7 @@ def ExecuteActionWithParam(action, ctx):
|
|||||||
success = cls_native.Native.Run_Physim(ctx, HTML, RAN.eNBIPAddress, RAN.eNBSourceCodePath, physim_options, physim_test, physim_threshold)
|
success = cls_native.Native.Run_Physim(ctx, HTML, RAN.eNBIPAddress, RAN.eNBSourceCodePath, physim_options, physim_test, physim_threshold)
|
||||||
|
|
||||||
elif action == 'LicenceAndFormattingCheck':
|
elif action == 'LicenceAndFormattingCheck':
|
||||||
success = SCA.LicenceAndFormattingCheck(HTML)
|
success = SCA.LicenceAndFormattingCheck(ctx, HTML)
|
||||||
|
|
||||||
elif action == 'Cppcheck_Analysis':
|
elif action == 'Cppcheck_Analysis':
|
||||||
success = SCA.CppCheckAnalysis(HTML)
|
success = SCA.CppCheckAnalysis(HTML)
|
||||||
|
|||||||
Reference in New Issue
Block a user