blob: 58678177b31c207191445c8e6b0d30fa28f46e5e [file] [log] [blame]
Roman Lubianyi1ee62562021-11-08 15:05:45 +02001salt = new com.mirantis.mk.Salt()
2python = new com.mirantis.mk.Python()
3common = new com.mirantis.mk.Common()
4venvPepper = "venvPepper"
5upgradeChecks = new com.mirantis.mcp.UpgradeChecks()
6
7reportDir = 'reportDir/'
Oleksii Molchanov0f4d6902023-01-11 11:19:01 +02008waList =['check_34406', 'check_34645', 'check_35705', 'check_35884', 'check_36461', 'check_36461_2', 'check_36960', 'check_37068']
Roman Lubianyi1ee62562021-11-08 15:05:45 +02009
10timeout(time: PIPELINE_TIMEOUT, unit: 'HOURS') {
11 node('python') {
12 try {
13 python.setupPepperVirtualenv(venvPepper, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
14 def clusterName = salt.getPillar(venvPepper, 'I@salt:master', "_param:cluster_name").get("return")[0].values()[0]
15 def reportContent = ""
16 stage('Start checking work-arounds') {
17 for (wa in waList) {
18 //false - return status of check, true - raise exception
19 def waData = upgradeChecks."$wa"(salt, venvPepper, clusterName, false)
20 def reportTemplate = """
21 <tr>
22 <td class='row'>${waData.prodId}</td>
23 <td class='row'>${waData.isFixed}</td>
24 <td class='row'>${waData.waInfo}</td>
25 </tr>"""
26 reportContent = "${reportContent}${reportTemplate}"
27 }
28 }
29 stage('Generate report') {
30 sh "rm -rf ${reportDir}"
31 sh "mkdir -p ${reportDir}"
32 def reportHead = """<html>
33 <head>
34 <title>WA verify report</title>
35 </head>
36 <body>
37 <h1>WA verify report</h1>
38 <table border='1' cellpadding='5' cellspacing='0' style='border-collapse:collapse'>
39 <tr>
40 <th class='row'>Prod id</th>
41 <th class='row'>Status</th>
Vladimir Khlyunevfe415cc2022-08-02 13:58:43 +040042 <th class='row'>Comment</th>
Roman Lubianyi1ee62562021-11-08 15:05:45 +020043 </tr>"""
44 def reportTail = """
45 </table>
46 </body>
47</html>"""
48 writeFile file: "${reportDir}report.html", text: "${reportHead}${reportContent}${reportTail}"
49 archiveArtifacts artifacts: "${reportDir}/*"
50 }
51 } catch (Throwable e) {
52 // If there was an error or exception thrown, the build failed
53 currentBuild.result = "FAILURE"
54 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
55 throw e
56 }
57 }
58}