Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r8d63649 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        }
     
    170176        build_stage('Publish') {
    171177
    172                 if( !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
    173 
    174                 def groupCompile = new PlotGroup('Compilation', 'seconds', true)
    175                 def groupConcurrency = new PlotGroup('Concurrency', 'nanoseconds', false)
     178                if( !Settings.Publish ) return
    176179
    177180                //Then publish the results
    178                 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile'  , groupCompile    , 'Compilation')
    179                 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch', groupConcurrency, 'Context Switching')
    180                 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex'    , groupConcurrency, 'Mutual Exclusion')
    181                 do_plot(Settings.RunBenchmark && Settings.Publish, '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'
    182182        }
    183183}
     
    196196
    197197        return """
    198 <pre>
    199198The branch ${env.BRANCH_NAME} has been updated.
    200199${gitUpdate}
    201 </pre>
    202 
    203 <p>Check console output at ${env.BUILD_URL} to view the results.</p>
    204 
    205 <p>- Status --------------------------------------------------------------</p>
    206 
    207 <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
    208 
    209 <p>- Log -----------------------------------------------------------------</p>
    210 
    211 <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 -----------------------------------------------------------------
    212208${gitLog}
    213 </pre>
    214 
    215 <p>-----------------------------------------------------------------------</p>
    216 <pre>
     209-----------------------------------------------------------------------
    217210Summary of changes:
    218211${gitDiff}
    219 </pre>
    220212"""
    221213}
    222214
    223215//Standard build email notification
    224 def email(boolean log) {
     216def email(boolean log, boolean bIsSandbox) {
    225217        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
    226218        //Configurations for email format
     
    229221        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    230222        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}"
    231         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
    232224generated because of a git hooks/post-receive script following
    233 a ref change which was pushed to the C∀ repository.</p>
     225a ref change which was pushed to the Cforall repository.
    234226""" + GitLogMessage()
    235227
    236         def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
    237 
    238         if( Settings && !Settings.Silent ) {
     228        def email_to = "cforall@lists.uwaterloo.ca"
     229
     230        if( Settings && !Settings.IsSandbox ) {
    239231                //send email notification
    240232                emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
     
    319311                }
    320312
    321                 this.IsSandbox          = (branch == "jenkins-sandbox")
    322313                this.RunAllTests        = param.RunAllTests
    323314                this.RunBenchmark       = param.RunBenchmark
     
    325316                this.Publish            = param.Publish
    326317                this.Silent             = param.Silent
     318                this.IsSandbox          = (branch == "jenkins-sandbox")
    327319
    328320                def full = param.RunAllTests ? " (Full)" : ""
     
    341333                this.GitNewRef = ''
    342334                this.GitOldRef = ''
    343         }
    344 }
    345 
    346 class PlotGroup implements Serializable {
    347         public String name
    348         public String unit
    349         public boolean log
    350 
    351         PlotGroup(String name, String unit, boolean log) {
    352                 this.name = name
    353                 this.unit = unit
    354                 this.log = log
    355335        }
    356336}
     
    418398}
    419399
     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
    420405def make_doc() {
    421406        def err = null
     
    432417        }
    433418}
    434 
    435 def do_plot(boolean silent, String file, PlotGroup group, String title) {
    436 
    437         def series = silent ? [] : [[
    438                                 file: "${file}.csv",
    439                                 exclusionValues: '',
    440                                 displayTableFlag: false,
    441                                 inclusionFlag: 'OFF',
    442                                 url: ''
    443                         ]];
    444 
    445         echo "file is ${BuildDir}/benchmark/${file}.csv, group ${group}, title ${title}"
    446         dir("${BuildDir}/benchmark/") {
    447                 plot csvFileName: "cforall-${env.BRANCH_NAME}-${file}.csv",
    448                         csvSeries: series,
    449                         group: "${group.name}",
    450                         title: "${title}",
    451                         style: 'lineSimple',
    452                         exclZero: false,
    453                         keepRecords: false,
    454                         logarithmic: group.log,
    455                         numBuilds: '120',
    456                         useDescr: true,
    457                         yaxis: group.unit,
    458                         yaxisMaximum: '',
    459                         yaxisMinimum: ''
    460         }
    461 }
Note: See TracChangeset for help on using the changeset viewer.