Changeset 7b1a604


Ignore:
Timestamp:
Jun 6, 2016, 12:22:50 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, 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:
ab60d6d
Parents:
de62f0f0
Message:
  • Removed properties from Jenkinsfile
  • Email sent now writes correct summary of changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    rde62f0f0 r7b1a604  
    7474        status_prefix = ''
    7575
    76         //Properties sent by the git-hooks (ref name, latest commit hash, previous commit hash)
    77         // properties( [[$class: 'ParametersDefinitionProperty', parameterDefinitions: \
    78         //              [[$class: 'StringParameterDefinition', name: 'GitRefName',     defaultValue: 'master', description: 'name of the ref that changed' ], \
    79         //               [$class: 'StringParameterDefinition', name: 'GitRefNewValue', defaultValue: 'HEAD',   description: 'new commit of the reference' ],  \
    80         //               [$class: 'StringParameterDefinition', name: 'GitRefOldValue', defaultValue: 'HEAD~1', description: 'old commit of the reference']]   \
    81         //      ]] )
     76        try {
    8277
    83         try {
    84                 def out_dir = pwd tmp: true
    85                 gitRefName = env.BRANCH_NAME
    86                 dir("../${gitRefName}@script") {
    87                         sh "git reflog > ${out_dir}/GIT_COMMIT"
    88                 }
    89                 git_reflog = readFile("${out_dir}/GIT_COMMIT")
    90                 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
    91                 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]
    92 
    93                 echo "Properties-start"
    94                 echo "ref name      : ${gitRefName}"
    95                 echo "ref new value : ${gitRefNewValue}"
    96                 echo "ref old value : ${gitRefOldValue}"
    97                 echo "Properties-stop"
    9878
    9979                //Prevent the build from exceeding 30 minutes
     
    10282                        //Wrap build to add timestamp to command line
    10383                        wrap([$class: 'TimestamperBuildWrapper']) {
     84
     85                                collect_git_info()
    10486
    10587                                //Compile using gcc-4.9
     
    145127}
    146128
     129def collect_git_info() {
     130
     131        def out_dir = pwd tmp: true
     132        gitRefName = env.BRANCH_NAME
     133        dir("../${gitRefName}@script") {
     134                sh "git reflog > ${out_dir}/GIT_COMMIT"
     135        }
     136        git_reflog = readFile("${out_dir}/GIT_COMMIT")
     137        gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
     138        gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]
     139}
     140
    147141//===========================================================================================================
    148142//Routine responsible of sending the email notification once the build is completed
     
    153147        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
    154148
     149        sh "git rev-list --format=short ${gitRefOldValue}...${gitRefNewValue} > GIT_LOG"
     150        def gitLog = readFile('GIT_LOG')
     151
     152        sh "git diff --stat ${gitRefNewValue} ${gitRefOldValue} > GIT_DIFF"
     153        def gitDiff = readFile('GIT_DIFF')
     154
    155155        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}"
    156156        def email_body = """This is an automated email from the Jenkins build machine. It was
     
    160160
    161161The branch ${env.BRANCH_NAME} has been updated.
     162         via  ${gitRefOldValue} (commit)
     163        from  ${gitRefNewValue} (commit)
    162164
    163 Check console output at ${env.BUILD_URL} to view the results."""
     165Check console output at ${env.BUILD_URL} to view the results.
    164166
    165         // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
    166         // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
     167- Status --------------------------------------------------------------
     168
     169BUILD# ${env.BUILD_NUMBER} - ${status}
     170
     171- Log -----------------------------------------------------------------
     172${gitLog}
     173-----------------------------------------------------------------------
     174Summary of changes:
     175${gitDiff}
     176"""
     177
    167178        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
    168179
Note: See TracChangeset for help on using the changeset viewer.