Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r30e32b2 r3898392  
    11#!groovy
     2
     3import groovy.transform.Field
    24
    35//===========================================================================================================
     
    2224                wrap([$class: 'TimestamperBuildWrapper']) {
    2325
    24                         notify_server(0)
    25 
    2626                        Settings = prepare_build()
    2727
     
    3434                                checkout()
    3535
    36                                 notify_server(0)
    37 
    3836                                build()
    3937
     
    5048                        BuildDir  = pwd tmp: true
    5149                        SrcDir    = pwd tmp: false
    52 
    53                         notify_server(45)
    5450                }
    5551        }
     
    7268        finally {
    7369                //Send email with final results if this is not a full build
    74                 if( Settings && !Settings.Silent ) {
    75                         email(log_needed, Settings.IsSandbox)
    76                 }
     70                email(log_needed)
    7771
    7872                echo 'Build Completed'
     
    116110                        //Also specify the compiler by hand
    117111                        targets=""
    118                         if( Settings.RunAllTests ) {
     112                        if( Settings.RunAllTests || Settings.RunBenchmark ) {
    119113                                targets="--with-target-hosts='host:debug,host:nodebug'"
    120114                        } else {
     
    153147                dir (BuildDir) {
    154148                        //Append bench results
    155                         sh "${SrcDir}/benchmark/jenkins.sh ${Settings.GitNewRef} ${Settings.Architecture} ${BuildDir}/bench.json"
     149                        sh "make --no-print-directory -C benchmark jenkins"
    156150                }
    157151        }
     
    177171
    178172                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)
    179180
    180181                //Then publish the results
    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'
     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')
    182186        }
    183187}
     
    196200
    197201        return """
     202<pre>
    198203The branch ${env.BRANCH_NAME} has been updated.
    199204${gitUpdate}
    200 
    201 Check console output at ${env.BUILD_URL} to view the results.
    202 
    203 - Status --------------------------------------------------------------
    204 
    205 BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}
    206 
    207 - Log -----------------------------------------------------------------
     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>
    208216${gitLog}
    209 -----------------------------------------------------------------------
     217</pre>
     218
     219<p>-----------------------------------------------------------------------</p>
     220<pre>
    210221Summary of changes:
    211222${gitDiff}
     223</pre>
    212224"""
    213225}
    214226
    215227//Standard build email notification
    216 def email(boolean log, boolean bIsSandbox) {
     228def email(boolean log) {
    217229        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
    218230        //Configurations for email format
     
    221233        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    222234        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}"
    223         def email_body = """This is an automated email from the Jenkins build machine. It was
     235        def email_body = """<p>This is an automated email from the Jenkins build machine. It was
    224236generated because of a git hooks/post-receive script following
    225 a ref change which was pushed to the Cforall repository.
     237a ref change which was pushed to the C∀ repository.</p>
    226238""" + GitLogMessage()
    227239
    228         def email_to = "cforall@lists.uwaterloo.ca"
    229 
    230         if( Settings && !Settings.IsSandbox ) {
     240        def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
     241
     242        if( Settings && !Settings.Silent ) {
    231243                //send email notification
    232244                emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
     
    311323                }
    312324
     325                this.IsSandbox          = (branch == "jenkins-sandbox")
    313326                this.RunAllTests        = param.RunAllTests
    314327                this.RunBenchmark       = param.RunBenchmark
     
    316329                this.Publish            = param.Publish
    317330                this.Silent             = param.Silent
    318                 this.IsSandbox          = (branch == "jenkins-sandbox")
    319331
    320332                def full = param.RunAllTests ? " (Full)" : ""
     
    333345                this.GitNewRef = ''
    334346                this.GitOldRef = ''
     347        }
     348}
     349
     350class 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
    335359        }
    336360}
     
    398422}
    399423
    400 def 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 
    405424def make_doc() {
    406425        def err = null
     
    417436        }
    418437}
     438
     439def 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.