Commit ecf85ec6 authored by Mohammed Ismail's avatar Mohammed Ismail
Browse files

CI: added env for dstester version checkout and updated accordingly


Signed-off-by: default avatarMohammed Ismail <mohammed.ismail@openairinterface.org>
parent fcb6cfca
......@@ -52,6 +52,9 @@ def dsT_host = ""
def dsT_host_user = ""
def dsT_host_ip_addr = ""
// dsTester tag to use
def dsTesterTag = params.DSTESTER_TAG
// Flags
def scmEvent = false
def upstreamEvent = false
......@@ -327,12 +330,14 @@ pipeline {
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.dsTesterGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_token']
]) {
sh "git clone https://${git_username}:${git_token}@github.com/OPENAIRINTERFACE/chasseur.git . > ../git_clone.log 2>&1"
sh "git checkout develop >> ../git_clone.log 2>&1"
try {
sh "python3 jenkins/dogmatix-agent.py -f jenkins/suit-docker-compose.yaml | tee ../DS-TEST-RESULTS/dsTester_Summary.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Running FAILED"
sh "git checkout -f " + dsTesterTag + " >> ../git_clone.log 2>&1"
dir ('jenkins') {
try {
sh "python3 ./dogmatix-agent.py -f ./suits/dc/integration.yaml -d true | tee ../DS-TEST-RESULTS/dsTester_Summary.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Running FAILED"
}
}
}
}
......
......@@ -47,6 +47,9 @@ def dsT_host = ""
def dsT_host_user = ""
def dsT_host_ip_addr = ""
// dsTester tag to use
def dsTesterTag = params.DSTESTER_TAG
// Flags
def scmEvent = false
def upstreamEvent = false
......@@ -189,12 +192,14 @@ pipeline {
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.dsTesterGitLabRepository_Credentials}", usernameVariable: 'git_username', passwordVariable: 'git_token']
]) {
sh "git clone https://${git_username}:${git_token}@github.com/OPENAIRINTERFACE/chasseur.git . > ../git_clone.log 2>&1"
sh "git checkout develop >> ../git_clone.log 2>&1"
try {
sh "python3 jenkins/dogmatix-agent.py -f jenkins/suit-helm-charts.yaml | tee ../DS-TEST-RESULTS/dsTester_Summary.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Running FAILED"
sh "git checkout -f " + dsTesterTag + " >> ../git_clone.log 2>&1"
dir ('jenkins') {
try {
sh "python3 ./dogmatix-agent.py -f ./suits/hc/integration.yaml -d true | tee ../DS-TEST-RESULTS/dsTester_Summary.txt"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
echo "dsTester Running FAILED"
}
}
}
}
......
......@@ -247,8 +247,8 @@ class HtmlReport():
self.file.write(' <h2>DS Tester Summary</h2>\n')
cwd = os.getcwd()
finalStatusOK = False
if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/5gcn.yaml || true'
if os.path.isfile(cwd + '/DS-TEST-RESULTS/hcintegration.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/hcintegration.yaml || true'
ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8')
if ret.stdout is not None:
if ret.stdout.strip() == '1':
......@@ -281,8 +281,8 @@ class HtmlReport():
self.file.write(' <th>Test Details</th>\n')
self.file.write(' </tr>\n')
cwd = os.getcwd()
if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'):
with open(cwd + '/DS-TEST-RESULTS/5gcn.yaml') as f:
if os.path.isfile(cwd + '/DS-TEST-RESULTS/hcintegration.yaml'):
with open(cwd + '/DS-TEST-RESULTS/hcintegration.yaml') as f:
data = yaml.load(f)
nScenarios = len(data['scenarios'])
for scenario in range(nScenarios):
......
......@@ -216,8 +216,8 @@ class HtmlReport():
self.file.write(' <h2>DS Tester Summary</h2>\n')
cwd = os.getcwd()
finalStatusOK = False
if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/5gcn.yaml || true'
if os.path.isfile(cwd + '/DS-TEST-RESULTS/mvc.yaml'):
cmd = f'egrep -c "final-result: pass" DS-TEST-RESULTS/mvc.yaml || true'
ret = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, encoding='utf-8')
if ret.stdout is not None:
if ret.stdout.strip() == '1':
......@@ -250,8 +250,8 @@ class HtmlReport():
self.file.write(' <th>Test Details</th>\n')
self.file.write(' </tr>\n')
cwd = os.getcwd()
if os.path.isfile(cwd + '/DS-TEST-RESULTS/5gcn.yaml'):
with open(cwd + '/DS-TEST-RESULTS/5gcn.yaml') as f:
if os.path.isfile(cwd + '/DS-TEST-RESULTS/mvc.yaml'):
with open(cwd + '/DS-TEST-RESULTS/mvc.yaml') as f:
data = yaml.load(f)
nScenarios = len(data['scenarios'])
for scenario in range(nScenarios):
......
......@@ -35,6 +35,7 @@ try:
result = re.search('(?:\/.+?\/)(.+?)(?:\/.+)', str(line))
if result:
result1 = re.search('^(.*/)([^/]*)$', str(result.group(0)))
filename = re.search('[^/]*$', str(result1.group(0)))
subprocess.check_output(f'cp {result1.group(1)}* DS-TEST-RESULTS/', stderr=subprocess.STDOUT, shell=True, universal_newlines=True)
locexist = True
except IOError:
......@@ -42,9 +43,9 @@ except IOError:
if locexist:
try:
with open(cwd + '/DS-TEST-RESULTS/5gcn.yaml') as f:
with open(cwd + f'/DS-TEST-RESULTS/{filename.group(0)}') as f:
data = yaml.load(f)
if data["final-result"] == 'fail':
sys.exit('DsTester final result FAILED')
except IOError:
sys.exit("File not accessible to check DSTester result: DS-TEST-RESULTS/5gcn.yaml")
\ No newline at end of file
sys.exit(f'File not accessible to check DSTester result: DS-TEST-RESULTS/{filename.group(0)}')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment