source: Jenkins/FullBuild@ 83dccdd

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 83dccdd was 18a1419, checked in by Thierry Delisle <tdelisle@…>, 9 years ago

fixed various small issues with full build also reactivated emails and push to do-lang

  • Property mode set to 100644
File size: 3.9 KB
Line 
1#!groovy
2
3//===========================================================================================================
4// Main compilation routines
5//===========================================================================================================
6def push_build() {
7 //Don't use the build_stage function which outputs the compiler
8 stage 'Push'
9
10 status_prefix = 'Push'
11
12 def out_dir = pwd tmp: true
13 sh "mkdir -p ${out_dir}"
14
15 //parse git logs to find what changed
16 sh "git remote > ${out_dir}/GIT_REMOTE"
17 git_remote = readFile("${out_dir}/GIT_REMOTE")
18 remoteDoLangExists = git_remote.contains("DoLang")
19
20 if( !remoteDoLangExists ) {
21 sh 'git remote add DoLang git@gitlab.do-lang.org:internal/cfa-cc.git'
22 }
23
24 sh "git push DoLang ${gitRefNewValue}:master"
25}
26
27//===========================================================================================================
28// Main loop of the compilation
29//===========================================================================================================
30
31try {
32 //Prevent the build from exceeding 30 minutes
33 timeout(60) {
34
35 //Wrap build to add timestamp to command line
36 wrap([$class: 'TimestamperBuildWrapper']) {
37
38 stage 'Build'
39
40 results = [null, null]
41
42 parallel (
43 x64: {
44 result[0] = build job: 'Cforall/master', \
45 parameters: [ \
46 [$class: 'BooleanParameterValue', \
47 name: 'isFullBuild', \
48 value: true], \
49 [$class: 'StringParameterValue', \
50 name: 'buildArchitecture', \
51 value: '64-bit'] \
52 ]
53 },
54 x32:
55 {
56 result[1] = build job: 'Cforall/master', \
57 parameters: [ \
58 [$class: 'BooleanParameterValue', \
59 name: 'isFullBuild', \
60 value: true], \
61 [$class: 'StringParameterValue', \
62 name: 'buildArchitecture', \
63 value: '32-bit'] \
64 ]
65 }
66 )
67
68 results.each { result ->
69 echo(result.result)
70 echo(result.absoluteUrl)
71
72 if (result.result != 'SUCCESS') {
73 echo( 'Build Succeded' )
74 }
75 }
76
77 //Push latest changes to do-lang repo
78 push_build()
79 }
80 }
81}
82
83//If an exception is caught we need to change the status and remember to
84//attach the build log to the email
85catch (Exception caughtError) {
86 //rethrow error later
87 err = caughtError
88
89 //Store the result of the build log
90 currentBuild.result = "${status_prefix} FAILURE".trim()
91
92 //Send email to notify the failure
93 promote_email(currentBuild.result)
94}
95
96finally {
97 //Must re-throw exception to propagate error
98 if (err) {
99 throw err
100 }
101}
102
103//===========================================================================================================
104//Routine responsible of sending the email notification once the build is completed
105//===========================================================================================================
106
107//Email notification on a full build failure
108def promote_email(String status) {
109 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
110 //Configurations for email format
111 def email_subject = "[cforall git][PROMOTE - FAILURE]"
112 def email_body = """This is an automated email from the Jenkins build machine. It was
113generated because of a git hooks/post-receive script following
114a ref change was pushed to the repository containing
115the project "UNNAMED PROJECT".
116
117Check console output at ${env.BUILD_URL} to view the results.
118
119- Status --------------------------------------------------------------
120
121PROMOTE FAILURE - ${status}
122"""
123
124 def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
125
126 //send email notification
127 emailext body: email_body, subject: email_subject, to: email_to, attachLog: true
128}
Note: See TracBrowser for help on using the repository browser.