Changeset a3dc4cc for Jenkinsfile


Ignore:
Timestamp:
Apr 29, 2019, 9:21:58 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c66254e
Parents:
b10c39a0 (diff), 986e260 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    rb10c39a0 ra3dc4cc  
    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        }
     
    176170        build_stage('Publish') {
    177171
    178                 if( !Settings.Publish ) return
     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)
    179176
    180177                //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'
     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')
    182182        }
    183183}
     
    196196
    197197        return """
     198<pre>
    198199The branch ${env.BRANCH_NAME} has been updated.
    199200${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 -----------------------------------------------------------------
     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>
    208212${gitLog}
    209 -----------------------------------------------------------------------
     213</pre>
     214
     215<p>-----------------------------------------------------------------------</p>
     216<pre>
    210217Summary of changes:
    211218${gitDiff}
     219</pre>
    212220"""
    213221}
    214222
    215223//Standard build email notification
    216 def email(boolean log, boolean bIsSandbox) {
     224def email(boolean log) {
    217225        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
    218226        //Configurations for email format
     
    221229        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    222230        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
     231        def email_body = """<p>This is an automated email from the Jenkins build machine. It was
    224232generated because of a git hooks/post-receive script following
    225 a ref change which was pushed to the Cforall repository.
     233a ref change which was pushed to the C\u2200 repository.</p>
    226234""" + GitLogMessage()
    227235
    228         def email_to = "cforall@lists.uwaterloo.ca"
    229 
    230         if( Settings && !Settings.IsSandbox ) {
     236        def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
     237
     238        if( Settings && !Settings.Silent ) {
    231239                //send email notification
    232240                emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
     
    311319                }
    312320
     321                this.IsSandbox          = (branch == "jenkins-sandbox")
    313322                this.RunAllTests        = param.RunAllTests
    314323                this.RunBenchmark       = param.RunBenchmark
     
    316325                this.Publish            = param.Publish
    317326                this.Silent             = param.Silent
    318                 this.IsSandbox          = (branch == "jenkins-sandbox")
    319327
    320328                def full = param.RunAllTests ? " (Full)" : ""
     
    333341                this.GitNewRef = ''
    334342                this.GitOldRef = ''
     343        }
     344}
     345
     346class 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
    335355        }
    336356}
     
    398418}
    399419
    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 
    405420def make_doc() {
    406421        def err = null
     
    417432        }
    418433}
     434
     435def 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.