Changeset 29f4fe62 for Jenkinsfile


Ignore:
Timestamp:
Jun 3, 2016, 11:21:46 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
65fdb59
Parents:
992c26d
Message:
  • added comments to jenkinsfile
  • build now has timestamps for operation
  • build now has a timeout of 30 minutes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r992c26d r29f4fe62  
    11
     2//===========================================================================================================
     3// Main compilation routine
     4//===========================================================================================================
     5//Compilation script is done here but environnement set-up and error handling is done in main loop
    26def build() {
    37        build_stage 'Checkout'
     
    2024        build_stage 'Test'
    2125
    22                 status_prefix = 'Test'
    23 
     26                //Run the tests from the example directory
    2427                dir ('src/examples') {
    2528                        sh './runTests.sh'
     
    2831        build_stage 'Cleanup'
    2932
    30                 //install doesn't need to be cleaned since prefix uses temporary workspace
     33                //Cleanup the install dir
     34                sh "rm -rf ${install_dir}/*"
    3135}
    3236
     37//===========================================================================================================
     38// Helper classes/variables/routines to make the status and stage name easier to use
     39//===========================================================================================================
     40//Description of a compiler
    3341class CC_Desc {
    3442        String name
     
    3745}
    3846
     47//Global Variables defining the compiler and at which point in the build we are
    3948def currentCC
     49def status_prefix
    4050
     51//Wrapper to sync stage name and status name
    4152def build_stage(String name) {
    4253        def stage_name = "${currentCC.name} ${name}".trim()
     
    4657}
    4758
     59//===========================================================================================================
     60// Main loop of the compilation
     61//===========================================================================================================
    4862node ('master'){
    4963
    5064        def err = null
    51         def status_prefix
    5265        def log_needed = false
    5366        currentBuild.result = "SUCCESS"
    5467
    5568        try {
    56                 currentCC = ['gcc-4.9', 'g++-4.9', 'gcc-4.9'] as CC_Desc
    57                 build()
     69                //Prevent the build from exceeding 30 minutes
     70                timeout(30) {
     71
     72                        //Wrap build to add timestamp to command line
     73                        wrap([$class: 'TimestamperBuildWrapper']) {
     74
     75                                //Compile using gcc-4.9
     76                                currentCC = ['gcc-4.9', 'g++-4.9', 'gcc-4.9'] as CC_Desc
     77                                build()
     78
     79                        }
     80                }
    5881
    5982        }
    6083
     84        //If an exception is caught we need to change the status and remember to
     85        //attach the build log to the email
    6186        catch (Exception caughtError) {
     87                //rethrow error later
    6288                err = caughtError
     89
     90                //An error has occured, the build log is relevent
    6391                log_needed = true
     92
     93                //Store the result of the build log
    6494                currentBuild.result = "${status_prefix} FAILURE".trim()
    6595        }
     
    76106}
    77107
     108//===========================================================================================================
     109//Routine responsible of sending the email notification once the build is completed
     110//===========================================================================================================
    78111def email(String status, boolean log) {
    79112        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
Note: See TracChangeset for help on using the changeset viewer.