Changeset d29a394 for Jenkins


Ignore:
Timestamp:
Dec 3, 2020, 8:56:11 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7b2a786, cf2257f
Parents:
c3d3c22
Message:

Distribute not checksout a specific commit on the target node

Location:
Jenkins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/Distribute

    rc3d3c22 rd29a394  
    2626                wrap([$class: 'TimestamperBuildWrapper']) {
    2727
    28                         gitref = prepare_build()
     28                        final commit = prepare_build()
    2929
    3030                        node('x64') {
     
    3434                                Tools.clean()
    3535
    36                                 Tools.checkout(gitref)
     36                                Tools.checkout( commit )
    3737                        }
    3838
  • Jenkins/tools.groovy

    rc3d3c22 rd29a394  
    11#!groovy
    22
     3import groovy.transform.Field
    34
    45// For skipping stages
     
    3233}
    3334
     35def checkout(commitHash = null) {
     36        BuildStage('Checkout', true) {
     37                //checkout the source code and clean the repo
     38                final scmVars = ref ? checkout scm : checkout([$class: 'GitSCM', branches: [[name: commitHash ]]])
     39
     40                echo GitLogMessage(scmVars.GIT_COMMIT, scmVars.GIT_PREVIOUS_COMMIT)
     41        }
     42}
     43
     44//===========================================================================================================
     45//Routine responsible of sending the email notification once the build is completed
     46//===========================================================================================================
     47@NonCPS
     48def SplitLines(String text) {
     49        def list = []
     50
     51        text.eachLine {
     52                list += it
     53        }
     54
     55        return list
     56}
     57
     58def GitLogMessage(String oldRef, String newRef) {
     59        def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
     60        def revList = SplitLines( revText )
     61
     62        def gitUpdate = ""
     63        revList.each { rev ->
     64                def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     65                gitUpdate = gitUpdate + "       via  ${rev} (${type})"
     66        }
     67
     68        def rev = oldRef
     69        def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     70        gitUpdate = gitUpdate + "      from  ${rev} (${type})"
     71
     72        def gitLog    = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim()
     73
     74        def gitDiff   = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim()
     75        gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">')
     76        gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">')
     77        gitDiff = gitDiff.replace('[m', '</span>')
     78
     79        return """
     80<pre>
     81The branch ${env.BRANCH_NAME} has been updated.
     82${gitUpdate}
     83</pre>
     84
     85<p>Check console output at ${env.BUILD_URL} to view the results.</p>
     86
     87<p>- Status --------------------------------------------------------------</p>
     88
     89<p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
     90
     91<p>- Log -----------------------------------------------------------------</p>
     92
     93<pre>
     94${gitLog}
     95</pre>
     96
     97<p>-----------------------------------------------------------------------</p>
     98<pre>
     99Summary of changes:
     100${gitDiff}
     101</pre>
     102"""
     103}
     104
    34105return this;
Note: See TracChangeset for help on using the changeset viewer.