Changes in Jenkinsfile [ab60d6d:b67dc146]
- File:
-
- 1 edited
-
Jenkinsfile (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rab60d6d rb67dc146 64 64 } 65 65 66 //Helper routine to collect information about the git history67 def collect_git_info() {68 69 def out_dir = pwd tmp: true70 gitRefName = env.BRANCH_NAME71 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 79 66 //=========================================================================================================== 80 67 // Main loop of the compilation … … 85 72 def log_needed = false 86 73 currentBuild.result = "SUCCESS" 87 status_prefix = '' 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 ]] ) 88 81 89 82 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 90 89 //Prevent the build from exceeding 30 minutes 91 90 timeout(30) { … … 93 92 //Wrap build to add timestamp to command line 94 93 wrap([$class: 'TimestamperBuildWrapper']) { 95 96 collect_git_info()97 94 98 95 //Compile using gcc-4.9 … … 110 107 } 111 108 } 109 112 110 } 113 111 … … 144 142 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() 145 143 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 152 144 def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${status}] - branch ${env.BRANCH_NAME}" 153 145 def email_body = """This is an automated email from the Jenkins build machine. It was … … 157 149 158 150 The branch ${env.BRANCH_NAME} has been updated. 159 via ${gitRefOldValue} (commit)160 from ${gitRefNewValue} (commit)161 151 162 Check console output at ${env.BUILD_URL} to view the results. 152 Check console output at ${env.BUILD_URL} to view the results.""" 163 153 164 - Status -------------------------------------------------------------- 165 166 BUILD# ${env.BUILD_NUMBER} - ${status} 167 168 - Log ----------------------------------------------------------------- 169 ${gitLog} 170 ----------------------------------------------------------------------- 171 Summary of changes: 172 ${gitDiff} 173 """ 174 154 // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text 155 // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1] 175 156 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com" 176 157
Note:
See TracChangeset
for help on using the changeset viewer.