Commit da00013b authored by ismail's avatar ismail
Browse files

CI: updated to get the each pods log


Signed-off-by: default avatarismail <mohammed.ismail@openairinterface.org>
parent 6ec513d7
......@@ -9,7 +9,7 @@ namespace: "PROJECT"
image:
registry: local
repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-nrf
version: TAG
version: "TAG"
# pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
......
......@@ -9,7 +9,7 @@ namespace: "PROJECT"
image:
registry: local
repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-smf
version: TAG
version: "TAG"
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
......
......@@ -9,7 +9,7 @@ namespace: "PROJECT"
image:
registry: local
repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-spgwu-tiny
version: TAG
version: "TAG"
# pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
......
......@@ -204,11 +204,7 @@ pipeline {
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password']
]) {
dir('ci-scripts') {
try {
sh "python3 helmDeploy.py --mode=Deploy --remoteIPAdd=${params.remote_IPAddress} --remoteUserName=${remote_Username} --remotePassword=${remote_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}"
} catch (Exception e) {
currentBuild.result = 'FAILURE'
}
sh "python3 helmDeploy.py --mode=Deploy --remoteIPAdd=${params.remote_IPAddress} --remoteUserName=${remote_Username} --remotePassword=${remote_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}"
}
}
}
......@@ -236,6 +232,13 @@ pipeline {
}
}
}
dir('ci-scripts') {
try {
sh "python3 helmDeploy.py --mode=GetLogs --remoteIPAdd=${params.remote_IPAddress} --remoteUserName=${remote_Username} --remotePassword=${remote_Password} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName} --imageTags=${imageTags}"
} catch (Exception e) {
echo "Unable to get the 5gcn components pod logs"
}
}
}
}
}
......
......@@ -257,6 +257,34 @@ class ClusterDeploy:
mySSH.close()
self.AnalyzeLogFile_5gcn()
def GetLogsConfigs(self):
lIpAddr = self.remoteIPAdd
lUserName = self.remoteUserName
lPassWord = self.remotePassword
lSourcePath = self.sourceCodePath
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
images = self.imageTags.split(',')
for image in images:
eachImage = image.split(':')
imageName = eachImage[0]
imageTag = eachImage[1]
if imageName == 'mysql':
continue
if imageName == 'oai-nrf':
nameSufix = 'nrf'
elif imageName == 'oai-amf':
nameSufix = 'amf'
elif imageName == 'oai-smf':
nameSufix = 'smf'
elif imageName == 'oai-spgwu-tiny':
nameSufix = 'spgwu'
mySSH.command2(f'oc get pods -o wide -l app.kubernetes.io/instance={imageName}', 6, silent=True)
result = re.search(f'{imageName}[\S\d\w]+', mySSH.cmd2Results)
podName = result.group(0)
mySSH.command2(f'oc logs {podName} {nameSufix} > {lSourcePath}/archives/{imageName}_pod.log', 10, silent=True)
mySSH.command('oc logout', '\$', 6)
mySSH.close()
def AnalyzeLogFile_5gcn(self):
lIpAddr = self.remoteIPAdd
......@@ -338,4 +366,6 @@ while len(argvs) > 1:
if CN.mode == 'Deploy':
CN.Deploy_5gcn()
elif CN.mode == 'UnDeploy':
CN.UnDeploy_5gcn()
\ No newline at end of file
CN.UnDeploy_5gcn()
elif CN.mode == 'GetLogs':
CN.GetLogsConfigs()
\ No newline at end of file
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