[ae28ee2] | 1 | #!groovy
|
---|
| 2 |
|
---|
| 3 | //===========================================================================================================
|
---|
| 4 | // Main loop of the compilation
|
---|
| 5 | //===========================================================================================================
|
---|
| 6 |
|
---|
| 7 | node ('master') {
|
---|
| 8 | def err = null
|
---|
| 9 |
|
---|
[4af1021] | 10 | final scmVars = checkout scm
|
---|
| 11 | final commitId = scmVars.GIT_COMMIT
|
---|
[98168b9] | 12 |
|
---|
[ae28ee2] | 13 | try {
|
---|
[f408e1a] | 14 | //Wrap build to add timestamp to command line
|
---|
| 15 | wrap([$class: 'TimestamperBuildWrapper']) {
|
---|
| 16 |
|
---|
| 17 | stage('Build') {
|
---|
| 18 |
|
---|
| 19 | parallel (
|
---|
[849de65] | 20 | gcc_8_x86_old: { trigger_build( 'gcc-8', 'x86', false ) },
|
---|
| 21 | gcc_7_x86_old: { trigger_build( 'gcc-7', 'x86', false ) },
|
---|
| 22 | gcc_6_x86_old: { trigger_build( 'gcc-6', 'x86', false ) },
|
---|
| 23 | gcc_9_x64_old: { trigger_build( 'gcc-9', 'x64', false ) },
|
---|
| 24 | gcc_8_x64_old: { trigger_build( 'gcc-8', 'x64', false ) },
|
---|
| 25 | gcc_7_x64_old: { trigger_build( 'gcc-7', 'x64', false ) },
|
---|
| 26 | gcc_6_x64_old: { trigger_build( 'gcc-6', 'x64', false ) },
|
---|
| 27 | gcc_5_x64_old: { trigger_build( 'gcc-5', 'x64', false ) },
|
---|
| 28 | clang_x64_old: { trigger_build( 'clang', 'x64', false ) },
|
---|
[8089fde] | 29 | clang_x64_new: { trigger_build( 'clang', 'x64', true ) },
|
---|
[f408e1a] | 30 | )
|
---|
[ae28ee2] | 31 | }
|
---|
[8089fde] | 32 |
|
---|
| 33 | stage('Package') {
|
---|
[867fca3] | 34 | build job: 'Cforall_Distribute_Ref', parameters: [string(name: 'GitRef', value: commitId), string(name: 'Build', value: currentBuild.number.toString())]
|
---|
[8089fde] | 35 | }
|
---|
[ae28ee2] | 36 | }
|
---|
[13c98a4] | 37 |
|
---|
| 38 | promote_email(true)
|
---|
[ae28ee2] | 39 | }
|
---|
| 40 |
|
---|
| 41 | //If an exception is caught we need to change the status and remember to
|
---|
| 42 | //attach the build log to the email
|
---|
| 43 | catch (Exception caughtError) {
|
---|
| 44 | echo('error caught')
|
---|
| 45 |
|
---|
| 46 | //rethrow error later
|
---|
| 47 | err = caughtError
|
---|
| 48 |
|
---|
| 49 | //Store the result of the build log
|
---|
| 50 | currentBuild.result = 'FAILURE'
|
---|
| 51 |
|
---|
| 52 | //Send email to notify the failure
|
---|
[13c98a4] | 53 | promote_email(false)
|
---|
[ae28ee2] | 54 | }
|
---|
| 55 |
|
---|
| 56 | finally {
|
---|
| 57 | //Must re-throw exception to propagate error
|
---|
| 58 | if (err) {
|
---|
| 59 | throw err
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | //===========================================================================================================
|
---|
| 64 | // Main compilation routines
|
---|
| 65 | //===========================================================================================================
|
---|
| 66 |
|
---|
[956910d] | 67 | def trigger_build(String cc, String arch, boolean new_ast) {
|
---|
[ae28ee2] | 68 | def result = build job: 'Cforall/master', \
|
---|
| 69 | parameters: [ \
|
---|
[8fa3c7e6] | 70 | [$class: 'StringParameterValue', \
|
---|
[0c1d240] | 71 | name: 'Compiler', \
|
---|
[8fa3c7e6] | 72 | value: cc], \
|
---|
| 73 | [$class: 'StringParameterValue', \
|
---|
[0c1d240] | 74 | name: 'Architecture', \
|
---|
[8fa3c7e6] | 75 | value: arch], \
|
---|
[849de65] | 76 | [$class: 'BooleanParameterValue', \
|
---|
| 77 | name: 'NewAST', \
|
---|
| 78 | value: new_ast], \
|
---|
[ae28ee2] | 79 | [$class: 'BooleanParameterValue', \
|
---|
[0c1d240] | 80 | name: 'RunAllTests', \
|
---|
[8fa3c7e6] | 81 | value: true], \
|
---|
| 82 | [$class: 'BooleanParameterValue', \
|
---|
[0c1d240] | 83 | name: 'RunBenchmark', \
|
---|
[8fa3c7e6] | 84 | value: true], \
|
---|
| 85 | [$class: 'BooleanParameterValue', \
|
---|
[0c1d240] | 86 | name: 'BuildDocumentation', \
|
---|
[8fa3c7e6] | 87 | value: true], \
|
---|
| 88 | [$class: 'BooleanParameterValue', \
|
---|
[0c1d240] | 89 | name: 'Publish', \
|
---|
[849de65] | 90 | value: true], \
|
---|
[8fa3c7e6] | 91 | [$class: 'BooleanParameterValue', \
|
---|
[0c1d240] | 92 | name: 'Silent', \
|
---|
[ae28ee2] | 93 | value: true], \
|
---|
| 94 | ], \
|
---|
| 95 | propagate: false
|
---|
| 96 |
|
---|
| 97 | echo(result.result)
|
---|
| 98 |
|
---|
| 99 | if(result.result != 'SUCCESS') {
|
---|
[27474a7] | 100 | sh("wget -q -O - http://localhost:8084/jenkins/job/Cforall/job/master/${result.number}/consoleText")
|
---|
[ae28ee2] | 101 | error(result.result)
|
---|
| 102 | }
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | //===========================================================================================================
|
---|
| 106 | //Routine responsible of sending the email notification once the build is completed
|
---|
| 107 | //===========================================================================================================
|
---|
| 108 |
|
---|
| 109 | //Email notification on a full build failure
|
---|
[13c98a4] | 110 | def promote_email(boolean success) {
|
---|
[ae28ee2] | 111 | echo('notifying users')
|
---|
| 112 |
|
---|
[13c98a4] | 113 | def result = success ? "PROMOTE - SUCCESS" : "PROMOTE - FAILURE"
|
---|
| 114 |
|
---|
[ae28ee2] | 115 | //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
|
---|
| 116 | //Configurations for email format
|
---|
[13c98a4] | 117 | def email_subject = "[cforall git][${result}]"
|
---|
| 118 | def email_body = """<p>This is an automated email from the Jenkins build machine. It was
|
---|
[986e260] | 119 | generated following the result of the C\u2200 nightly build.</p>
|
---|
[13c98a4] | 120 |
|
---|
| 121 | <p>Check console output at ${env.BUILD_URL} to view the results.</p>
|
---|
| 122 |
|
---|
| 123 | <p>- Status --------------------------------------------------------------</p>
|
---|
[ae28ee2] | 124 |
|
---|
[13c98a4] | 125 | <p>${result}</p>
|
---|
[ae28ee2] | 126 |
|
---|
[b7b573c] | 127 | <p>- Performance ---------------------------------------------------------</p>
|
---|
[ae28ee2] | 128 |
|
---|
[38c0fe5] | 129 | <img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" >
|
---|
[a74554af] | 130 | <img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=1" >
|
---|
[b7b573c] | 131 |
|
---|
| 132 | <p>- Logs ----------------------------------------------------------------</p>
|
---|
[ae28ee2] | 133 | """
|
---|
| 134 |
|
---|
[e39647e] | 135 | def email_to = "cforall@lists.uwaterloo.ca"
|
---|
[ae28ee2] | 136 |
|
---|
| 137 | //send email notification
|
---|
[13c98a4] | 138 | emailext body: email_body, subject: email_subject, to: email_to, attachLog: !success
|
---|
[ae28ee2] | 139 | }
|
---|