Changes in / [0c827019:455a7d5]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r0c827019 r455a7d5  
    341341//Routine responsible of sending the email notification once the build is completed
    342342//===========================================================================================================
     343def gitBranchUpdate(String gitRefOldValue, String gitRefNewValue) {
     344        def update = ""
     345        sh "git rev-list ${gitRefOldValue}..${gitRefNewValue} > GIT_LOG";
     346        readFile('GIT_LOG').eachLine { rev ->
     347                sh "git cat-file -t ${rev} > GIT_TYPE"
     348                def type = readFile('GIT_TYPE')
     349
     350                update += "       via  ${rev} (${type})\n"
     351        }
     352        def rev = gitRefOldValue
     353        sh "git cat-file -t ${rev} > GIT_TYPE"
     354        def type = readFile('GIT_TYPE')
     355
     356        update += "      from  ${rev} (${type})\n"
     357        return update
     358
     359def output=readFile('result').trim()
     360echo "output=$output";
     361}
     362
    343363//Standard build email notification
    344364def email(String status, boolean log, boolean bIsSandbox) {
     
    349369        def gitLog = 'Error retrieving git logs'
    350370        def gitDiff = 'Error retrieving git diff'
     371        def gitUpdate = 'Error retrieving update'
    351372
    352373        try {
     374                gitUpdate = gitBranchUpdate(gitRefOldValue, gitRefNewValue)
    353375
    354376                sh "git rev-list --format=short ${gitRefOldValue}...${gitRefNewValue} > GIT_LOG"
     
    358380                gitDiff = readFile('GIT_DIFF')
    359381        }
    360         catch (Exception error) {}
     382        catch (Exception error) {
     383                echo error.toString()
     384                echo error.getMessage()
     385        }
    361386
    362387        def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}"
     
    367392
    368393The branch ${env.BRANCH_NAME} has been updated.
    369    via  ${gitRefOldValue} (commit)
    370   from  ${gitRefNewValue} (commit)
     394${gitUpdate}
    371395
    372396Check console output at ${env.BUILD_URL} to view the results.
Note: See TracChangeset for help on using the changeset viewer.