Changeset 685a5e8 for Jenkinsfile


Ignore:
Timestamp:
Jun 7, 2016, 11:27:55 AM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
db175c8
Parents:
2f6b7c9 (diff), d5f1cfc (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' into ctor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r2f6b7c9 r685a5e8  
    6464}
    6565
     66//Helper routine to collect information about the git history
     67def collect_git_info() {
     68
     69        def out_dir = pwd tmp: true
     70        gitRefName = env.BRANCH_NAME
     71        dir("../${gitRefName}@script") {
     72                sh "git reflog > ${out_dir}/GIT_COMMIT"
     73        }
     74        git_reflog = readFile("${out_dir}/GIT_COMMIT")
     75        gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
     76        gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]
     77}
     78
    6679//===========================================================================================================
    6780// Main loop of the compilation
     
    7285        def log_needed = false
    7386        currentBuild.result = "SUCCESS"
    74 
    75         //Properties sent by the git-hooks (ref name, latest commit hash, previous commit hash)
    76         properties( [[$class: 'ParametersDefinitionProperty', parameterDefinitions: \
    77                         [[$class: 'StringParameterDefinition', name: 'GitRefName',     defaultValue: 'master', description: 'name of the ref that changed' ], \
    78                          [$class: 'StringParameterDefinition', name: 'GitRefNewValue', defaultValue: 'HEAD',   description: 'new commit of the reference' ],  \
    79                          [$class: 'StringParameterDefinition', name: 'GitRefOldValue', defaultValue: 'HEAD~1', description: 'old commit of the reference']]   \
    80                 ]] )
     87        status_prefix = ''
    8188
    8289        try {
    83                 echo "Properties-start"
    84                 echo "ref name      : ${GitRefName}"
    85                 echo "ref new value : ${GitRefNewValue}"
    86                 echo "ref old value : ${GitRefOldValue}"
    87                 echo "Properties-stop"
    88 
    8990                //Prevent the build from exceeding 30 minutes
    9091                timeout(30) {
     
    9293                        //Wrap build to add timestamp to command line
    9394                        wrap([$class: 'TimestamperBuildWrapper']) {
     95
     96                                collect_git_info()
    9497
    9598                                //Compile using gcc-4.9
     
    107110                        }
    108111                }
    109 
    110112        }
    111113
     
    142144        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    143145
     146        sh "git rev-list --format=short ${gitRefOldValue}...${gitRefNewValue} > GIT_LOG"
     147        def gitLog = readFile('GIT_LOG')
     148
     149        sh "git diff --stat ${gitRefNewValue} ${gitRefOldValue} > GIT_DIFF"
     150        def gitDiff = readFile('GIT_DIFF')
     151
    144152        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}"
    145153        def email_body = """This is an automated email from the Jenkins build machine. It was
     
    149157
    150158The branch ${env.BRANCH_NAME} has been updated.
     159         via  ${gitRefOldValue} (commit)
     160        from  ${gitRefNewValue} (commit)
    151161
    152 Check console output at ${env.BUILD_URL} to view the results."""
     162Check console output at ${env.BUILD_URL} to view the results.
    153163
    154         // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
    155         // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
     164- Status --------------------------------------------------------------
     165
     166BUILD# ${env.BUILD_NUMBER} - ${status}
     167
     168- Log -----------------------------------------------------------------
     169${gitLog}
     170-----------------------------------------------------------------------
     171Summary of changes:
     172${gitDiff}
     173"""
     174
    156175        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
    157176
Note: See TracChangeset for help on using the changeset viewer.