Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r0961bf4 r3831b58  
    2828                wrap([$class: 'TimestamperBuildWrapper']) {
    2929
    30                         notify_server()
    31 
    32                         prepare_build()
    33 
    34                         checkout()
    35 
    36                         build()
    37 
    38                         test()
    39 
    40                         benchmark()
    41 
    42                         clean()
    43 
    44                         build_doc()
    45 
    46                         publish()
    47 
    48                         notify_server()
     30                        //Prevent the build from exceeding 60 minutes
     31                        timeout(60) {
     32
     33                                notify_server()
     34
     35                                prepare_build()
     36
     37                                checkout()
     38
     39                                build()
     40
     41                                test()
     42
     43                                benchmark()
     44
     45                                clean()
     46
     47                                build_doc()
     48
     49                                publish()
     50
     51                                notify_server()
     52                        }
    4953                }
    5054        }
     
    8589def collect_git_info() {
    8690
    87         checkout scm
    88 
    8991        //create the temporary output directory in case it doesn't already exist
    9092        def out_dir = pwd tmp: true
     
    9395        //parse git logs to find what changed
    9496        gitRefName = env.BRANCH_NAME
    95         sh "git reflog > ${out_dir}/GIT_COMMIT"
     97        dir("../${gitRefName}@script") {
     98                sh "git reflog > ${out_dir}/GIT_COMMIT"
     99        }
    96100        git_reflog = readFile("${out_dir}/GIT_COMMIT")
    97101        gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
     
    166170}
    167171
    168 def build_stage(String name, Closure block ) {
     172def build_stage(String name) {
    169173        stage_name = name
    170         stage(name, block)
     174        stage name
    171175}
    172176
     
    241245//Compilation script is done here but environnement set-up and error handling is done in main loop
    242246def checkout() {
    243         build_stage('Checkout') {
     247        build_stage'Checkout'
    244248                //checkout the source code and clean the repo
    245249                checkout scm
     
    250254                //Reset the git repo so no local changes persist
    251255                sh 'git reset --hard'
    252         }
    253256}
    254257
    255258def build() {
    256         build_stage('Build') {
     259        build_stage'Build'
    257260       
    258261                def install_dir = pwd tmp: true
     
    266269                //Compile the project
    267270                sh 'make -j 8 --no-print-directory V=0 install'
    268         }
    269271}
    270272
    271273def test() {
    272         build_stage('Test') {
     274        build_stage'Test'
    273275
    274276                //Run the tests from the tests directory
    275277                if ( do_alltests ) {
    276                         sh 'make -C src/tests all-tests debug=yes --no-print-directory'
    277                         sh 'make -C src/tests all-tests debug=no --no-print-directory'
     278                        sh 'make -C src/tests all-tests debug=yes'
     279                        sh 'make -C src/tests all-tests debug=no'
    278280                }
    279281                else {
    280                         sh 'make -C src/tests --no-print-directory'
    281                 }
    282         }
     282                        sh 'make -C src/tests'
     283                }
    283284}
    284285
    285286def benchmark() {
    286         build_stage('Benchmark') {
     287        build_stage'Benchmark'
    287288
    288289                if( !do_benchmark ) return
     
    293294                //Append bench results
    294295                sh 'make -C src/benchmark --no-print-directory csv-data >> bench.csv'
    295         }
    296296}
    297297
    298298def clean() {
    299         build_stage('Cleanup') {
     299        build_stage'Cleanup'
    300300
    301301                //do a maintainer-clean to make sure we need to remake from scratch
    302302                sh 'make maintainer-clean > /dev/null'
    303         }
    304303}
    305304
    306305def build_doc() {
    307         build_stage('Documentation') {
     306        build_stage'Documentation'
    308307
    309308                if( !do_doc ) return
     
    316315                        make_doc()
    317316                }
    318         }
    319317}
    320318
    321319def publish() {
    322         build_stage('Publish') {
     320        build_stage'Publish'
    323321
    324322                if( !do_publish ) return
     
    326324                //Then publish the results
    327325                sh 'curl --silent --data @bench.csv http://plg2:8082/jenkins/publish > /dev/null || true'
    328         }
    329326}
    330327
     
    374371"""
    375372
    376         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
     373        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
    377374
    378375        //send email notification
Note: See TracChangeset for help on using the changeset viewer.