-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathongoing_report.js
More file actions
104 lines (83 loc) · 7.83 KB
/
Copy pathongoing_report.js
File metadata and controls
104 lines (83 loc) · 7.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
REGRESSION_IS_DONE = false
pipeline {
agent any
options {
skipStagesAfterUnstable()
}
stages {
stage('Build') {
parallel {
stage('Monitor Regression Progress') {
steps {
script {
try {
vmanagerLaunch userFarmType: null, famMode: null, masterWorkspaceLocation: null, defineVariableType: null, defineVariableText: null, advConfig: false, archivePassword: '', archiveUser: '', attrValues: false, attrValuesFile: '', authRequired: true, connTimeout: 1, credentialInputFile: '', defineVarible: false, defineVaribleFile: '', deleteAlsoSessionDirectory: false, deleteCredentialInputFile: false, deleteInputFile: false, deleteSessionInputFile: false, doneResolver: 'ignore', dynamicUserId: false, envSourceInputFile: '', envSourceInputFileType: 'BSH', envVarible: false, envVaribleFile: '', executionScript: '', executionShellLocation: '', executionType: 'launcher', executionVsifFile: '', extraAttributesForFailures: false, failJobIfAllRunFailed: false, failJobUnlessAllRunPassed: false, failedResolver: 'fail', famModeLocation: '', generateJUnitXML: false, genericCredentialForSessionDelete: false, inaccessibleResolver: 'fail', markBuildAsFailedIfAllRunFailed: false, markBuildAsPassedIfAllRunPassed: false, noAppendSeed: false, pauseSessionOnBuildInterruption: false, pipelineNodes: false, readTimeout: 30, sessionsInputFile: '', staticAttributeList: '', stepSessionTimeout: 30, stoppedResolver: 'ignore', suspendedResolver: 'ignore', useUserOnFarm: false, userPrivateSSHKey: false, vAPIPassword: 'letmein', vAPIUrl: 'https://vlnx488:50500/vmgr/vapi', vAPIUser: 'root', vMGRBuildArchive: false, vSIFInputFile: '', vSIFName: '/home/tyanai/vsif/test.vsif', vsifType: 'static', waitTillSessionEnds: true
} finally {
//Must reside within try/catch block as the build itself might fail
echo "Marking the regression as completed for the report job (the other parallel branch) to also stop running"
REGRESSION_IS_DONE = 'true'
}
}
}
}
stage('Fetching Summary Report') {
steps {
//No point in trying to get the report before 2 minutes passed. It takes at least 1 minute for the regression
//to create the session_status.properties for the build which is also an indication that the report can be generated
sleep(time:150,unit:"SECONDS")
//The below is to make sure we don't try to bring the report before the file session_status.properties was created
//However, in case 2 minutes passed since the regression started, most likely something is wrong so timeout here is 2 minutes.
timeout(time:2,unit:'MINUTES') {
script {
waitUntil {
echo "Looking for $WORKSPACE/${env.BUILD_NUMBER}.${env.BUILD_ID}.session_status.properties"
def exists = fileExists "$WORKSPACE/${env.BUILD_NUMBER}.${env.BUILD_ID}.session_status.properties"
if (exists) {
echo "Found the input file for the vManager Report. Starting to execute the plugin to fetch reports."
return true
} else if (REGRESSION_IS_DONE){
echo "Regression is already done, so no point in keep waiting."
return true
} else {
echo "File for Report is not ready yet. Keep waiting..."
return false
}
}
echo "Waiting conditions have met to start generating the report or timeout."
}
}
script {
def timeToWait = 60 //Waiting time in second between each report
echo "REGRESSION_IS_DONE: " + REGRESSION_IS_DONE
while (!REGRESSION_IS_DONE) {
try {
vmanagerPostBuildActions metricsInputType: null, vPlanInputType: null, emailType: null, advConfig: false, advancedFunctions: true, authRequired: true, connTimeout: 1, ctxAdvanceInput: '', ctxInput: false, deleteEmailInputFile: false, deleteReportSyntaxInputFile: false, dynamicUserId: false, emailInputFile: '', emailList: '', freeVAPISyntax: '', ignoreSSLError: false, metricsAdvanceInput: '', metricsDepth: 6, metricsReport: false, metricsViewName: 'All_Metrics', readTimeout: 30, retrieveSummaryReport: true, runReport: true, sendEmail: false, summaryMode: 'full', summaryType: 'wizard', testsDepth: 6, testsViewName: 'Test_Hierarchy', vAPIPassword: 'letmein', vAPIUrl: 'https://vlnx488:50500/vmgr/vapi', vAPIUser: 'root', vManagerVersion: 'stream', vPlanAdvanceInput: '', vPlanDepth: 6, vPlanReport: false, vPlanxFileName: '', vplanViewName: 'All_Vplan'
} catch (err) {
//Must reside within try/catch block as the build itself might fail
echo err.getMessage()
echo "Attempt to bring the report failed. Marking for Exit"
REGRESSION_IS_DONE = true
}
//The below line is optional - it adds a link to the summary report right below the history table on the left.
currentBuild.description = "Click <a href='./${env.BUILD_NUMBER}/vManagerSummaryReport'>Regression Progress Report</a>"
//Wait X amount of seconds before trying to fetch yet an additonal report
echo "Waiting ${timeToWait} seconds before updating/fetching the summary report again..."
sleep(time:timeToWait,unit:"SECONDS")
}
}
}
}
}
}
stage('Post'){
//In any case, bring the report one last time at the end of the execution
steps {
vmanagerPostBuildActions metricsInputType: null, vPlanInputType: null, emailType: null, advConfig: false, advancedFunctions: true, authRequired: true, connTimeout: 1, ctxAdvanceInput: '', ctxInput: false, deleteEmailInputFile: false, deleteReportSyntaxInputFile: false, dynamicUserId: false, emailInputFile: '', emailList: '', freeVAPISyntax: '', ignoreSSLError: false, metricsAdvanceInput: '', metricsDepth: 6, metricsReport: false, metricsViewName: 'All_Metrics', readTimeout: 30, retrieveSummaryReport: true, runReport: true, sendEmail: false, summaryMode: 'full', summaryType: 'wizard', testsDepth: 6, testsViewName: 'Test_Hierarchy', vAPIPassword: 'letmein', vAPIUrl: 'https://vlnx488:50500/vmgr/vapi', vAPIUser: 'root', vManagerVersion: 'stream', vPlanAdvanceInput: '', vPlanDepth: 6, vPlanReport: false, vPlanxFileName: '', vplanViewName: 'All_Vplan'
//The below line is optional - it adds a link to the summary report right below the history table on the left.
script {
currentBuild.description = "Click <a href='./${env.BUILD_NUMBER}/vManagerSummaryReport'>Regression Progress Report</a>"
}
}
}
}
}