Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r3898392 r30e32b2  
    11#!groovy
    2 
    3 import groovy.transform.Field
    42
    53//===========================================================================================================
     
    2422                wrap([$class: 'TimestamperBuildWrapper']) {
    2523
     24                        notify_server(0)
     25
    2626                        Settings = prepare_build()
    2727
     
    3434                                checkout()
    3535
     36                                notify_server(0)
     37
    3638                                build()
    3739
     
    4850                        BuildDir  = pwd tmp: true
    4951                        SrcDir    = pwd tmp: false
     52
     53                        notify_server(45)
    5054                }
    5155        }
     
    6872        finally {
    6973                //Send email with final results if this is not a full build
    70                 email(log_needed)
     74                if( Settings && !Settings.Silent ) {
     75                        email(log_needed, Settings.IsSandbox)
     76                }
    7177
    7278                echo 'Build Completed'
     
    110116                        //Also specify the compiler by hand
    111117                        targets=""
    112                         if( Settings.RunAllTests || Settings.RunBenchmark ) {
     118                        if( Settings.RunAllTests ) {
    113119                                targets="--with-target-hosts='host:debug,host:nodebug'"
    114120                        } else {
     
    147153                dir (BuildDir) {
    148154                        //Append bench results
    149                         sh "make --no-print-directory -C benchmark jenkins"
     155                        sh "${SrcDir}/benchmark/jenkins.sh ${Settings.GitNewRef} ${Settings.Architecture} ${BuildDir}/bench.json"
    150156                }
    151157        }
     
    171177
    172178                if( !Settings.Publish ) return
    173                 if( !Settings.RunBenchmark ) {
    174                         echo 'No results to publish!!!'
    175                         return
    176                 }
    177 
    178                 def groupCompile = new PlotGroup('Compilation', 'seconds', true)
    179                 def groupConcurrency = new PlotGroup('Concurrency', 'nanoseconds', false)
    180179
    181180                //Then publish the results
    182                 do_plot('compile'  , groupCompile    , 'Compilation')
    183                 do_plot('ctxswitch', groupConcurrency, 'Context Switching')
    184                 do_plot('mutex'    , groupConcurrency, 'Mutual Exclusion')
    185                 do_plot('signal'   , groupConcurrency, 'Internal and External Scheduling')
     181                sh 'curl --silent --show-error -H \'Content-Type: application/json\' --data @${BuildDir}/bench.json https://cforall.uwaterloo.ca:8082/jenkins/publish > /dev/null || true'
    186182        }
    187183}
     
    200196
    201197        return """
    202 <pre>
    203198The branch ${env.BRANCH_NAME} has been updated.
    204199${gitUpdate}
    205 </pre>
    206 
    207 <p>Check console output at ${env.BUILD_URL} to view the results.</p>
    208 
    209 <p>- Status --------------------------------------------------------------</p>
    210 
    211 <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
    212 
    213 <p>- Log -----------------------------------------------------------------</p>
    214 
    215 <pre>
     200
     201Check console output at ${env.BUILD_URL} to view the results.
     202
     203- Status --------------------------------------------------------------
     204
     205BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}
     206
     207- Log -----------------------------------------------------------------
    216208${gitLog}
    217 </pre>
    218 
    219 <p>-----------------------------------------------------------------------</p>
    220 <pre>
     209-----------------------------------------------------------------------
    221210Summary of changes:
    222211${gitDiff}
    223 </pre>
    224212"""
    225213}
    226214
    227215//Standard build email notification
    228 def email(boolean log) {
     216def email(boolean log, boolean bIsSandbox) {
    229217        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
    230218        //Configurations for email format
     
    233221        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    234222        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}"
    235         def email_body = """<p>This is an automated email from the Jenkins build machine. It was
     223        def email_body = """This is an automated email from the Jenkins build machine. It was
    236224generated because of a git hooks/post-receive script following
    237 a ref change which was pushed to the C∀ repository.</p>
     225a ref change which was pushed to the Cforall repository.
    238226""" + GitLogMessage()
    239227
    240         def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
    241 
    242         if( Settings && !Settings.Silent ) {
     228        def email_to = "cforall@lists.uwaterloo.ca"
     229
     230        if( Settings && !Settings.IsSandbox ) {
    243231                //send email notification
    244232                emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
     
    323311                }
    324312
    325                 this.IsSandbox          = (branch == "jenkins-sandbox")
    326313                this.RunAllTests        = param.RunAllTests
    327314                this.RunBenchmark       = param.RunBenchmark
     
    329316                this.Publish            = param.Publish
    330317                this.Silent             = param.Silent
     318                this.IsSandbox          = (branch == "jenkins-sandbox")
    331319
    332320                def full = param.RunAllTests ? " (Full)" : ""
     
    345333                this.GitNewRef = ''
    346334                this.GitOldRef = ''
    347         }
    348 }
    349 
    350 class PlotGroup implements Serializable {
    351         public String name
    352         public String unit
    353         public boolean log
    354 
    355         PlotGroup(String name, String unit, boolean log) {
    356                 this.name = name
    357                 this.unit = unit
    358                 this.log = log
    359335        }
    360336}
     
    422398}
    423399
     400def notify_server(int wait) {
     401        sh """curl --silent --show-error --data "wait=${wait}" -X POST https://cforall.uwaterloo.ca:8082/jenkins/notify > /dev/null || true"""
     402        return
     403}
     404
    424405def make_doc() {
    425406        def err = null
     
    436417        }
    437418}
    438 
    439 def do_plot(String file, PlotGroup group, String title) {
    440         echo "file is ${BuildDir}/benchmark/${file}.csv, group ${group}, title ${title}"
    441         dir("${BuildDir}/benchmark/") {
    442                 plot csvFileName: "cforall-${env.BRANCH_NAME}-${file}.csv",
    443                         csvSeries: [[
    444                                 file: "${file}.csv",
    445                                 exclusionValues: '',
    446                                 displayTableFlag: false,
    447                                 inclusionFlag: 'OFF',
    448                                 url: ''
    449                         ]],
    450                         group: "${group.name}",
    451                         title: "${title}",
    452                         style: 'lineSimple',
    453                         exclZero: false,
    454                         keepRecords: false,
    455                         logarithmic: group.log,
    456                         numBuilds: '120',
    457                         useDescr: true,
    458                         yaxis: group.unit,
    459                         yaxisMaximum: '',
    460                         yaxisMinimum: ''
    461         }
    462 }
Note: See TracChangeset for help on using the changeset viewer.