Changes in Jenkinsfile [afab6dc:ab60d6d]
- File:
-
- 1 edited
-
Jenkinsfile (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rafab6dc rab60d6d 35 35 } 36 36 37 def push_build() {38 //Don't use the build_stage function which outputs the compiler39 stage 'Push'40 41 status_prefix = 'Push'42 43 def out_dir = pwd tmp: true44 sh "mkdir -p ${out_dir}"45 46 //parse git logs to find what changed47 sh "git remote > ${out_dir}/GIT_REMOTE"48 git_remote = readFile("${out_dir}/GIT_REMOTE")49 remoteDoLangExists = git_remote.contains("DoLang")50 51 if( !remoteDoLangExists ) {52 sh 'git remote add DoLang git@gitlab.do-lang.org:internal/cfa-cc.git'53 }54 55 sh "git push DoLang ${gitRefNewValue}:master"56 }57 58 37 //=========================================================================================================== 59 38 // Helper classes/variables/routines to make the status and stage name easier to use … … 88 67 def collect_git_info() { 89 68 90 //create the temporary output directory in case it doesn't already exist91 69 def out_dir = pwd tmp: true 92 sh "mkdir -p ${out_dir}"93 94 //parse git logs to find what changed95 70 gitRefName = env.BRANCH_NAME 96 71 dir("../${gitRefName}@script") { … … 107 82 node ('master'){ 108 83 109 boolean doPromoteBuild2DoLang110 84 def err = null 111 85 def log_needed = false … … 122 96 collect_git_info() 123 97 124 properties ([ \125 [$class: 'ParametersDefinitionProperty', \126 parameterDefinitions: [ \127 [$class: 'BooleanParameterDefinition', \128 defaultValue: false, \129 description: 'If true, the build will be promoted to the do-lang git repository (on successful builds only)', \130 name: 'promoteBuild2DoLang' \131 ]] \132 ]])133 134 doPromoteBuild2DoLang = promoteBuild2DoLang == 'true'135 136 echo "FULL BUILD = ${doPromoteBuild2DoLang}"137 138 98 //Compile using gcc-4.9 139 99 currentCC = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9') … … 148 108 cfa_build() 149 109 150 if( doPromoteBuild2DoLang ) {151 push_build()152 }153 110 } 154 111 } … … 170 127 finally { 171 128 //Send email with final results 172 notify_result(doPromoteBuild2DoLang, err,currentBuild.result, log_needed)129 email(currentBuild.result, log_needed) 173 130 174 131 /* Must re-throw exception to propagate error */ … … 182 139 //Routine responsible of sending the email notification once the build is completed 183 140 //=========================================================================================================== 184 def notify_result(boolean promote, Exception err, String status, boolean log) {185 if(promote) {186 if( err ) {187 promote_email(status)188 }189 }190 else {191 email(status, log)192 }193 }194 195 //Email notification on a full build failure196 def promote_email(String status) {197 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line198 //Configurations for email format199 def email_subject = "[cforall git][PROMOTE - FAILURE]"200 def email_body = """This is an automated email from the Jenkins build machine. It was201 generated because of a git hooks/post-receive script following202 a ref change was pushed to the repository containing203 the project "UNNAMED PROJECT".204 205 Check console output at ${env.BUILD_URL} to view the results.206 207 - Status --------------------------------------------------------------208 209 PROMOTE FAILURE - ${status}210 """211 212 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"213 214 //send email notification215 emailext body: email_body, subject: email_subject, to: email_to, attachLog: true216 }217 218 //Standard build email notification219 141 def email(String status, boolean log) { 220 142 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line … … 235 157 236 158 The branch ${env.BRANCH_NAME} has been updated. 237 via ${gitRefOldValue} (commit)238 from ${gitRefNewValue} (commit)159 via ${gitRefOldValue} (commit) 160 from ${gitRefNewValue} (commit) 239 161 240 162 Check console output at ${env.BUILD_URL} to view the results.
Note:
See TracChangeset
for help on using the changeset viewer.