source: Jenkins/Distribute@ cf2257f

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since cf2257f was cf2257f, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Removed incorrect error handling

  • Property mode set to 100644
File size: 3.4 KB
Line 
1#!groovy
2
3import groovy.transform.Field
4
5// For skipping stages
6import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
7
8//===========================================================================================================
9// Main loop of the compilation
10//===========================================================================================================
11
12node('master') {
13 // Globals
14 BuildDir = pwd tmp: true
15 SrcDir = pwd tmp: false
16 Settings = null
17
18 // Local variables
19 def err = null
20 def log_needed = false
21
22 currentBuild.result = "SUCCESS"
23
24 try {
25 //Wrap build to add timestamp to command line
26 wrap([$class: 'TimestamperBuildWrapper']) {
27
28 final commit = prepare_build()
29
30 node('x64') {
31 BuildDir = pwd tmp: true
32 SrcDir = pwd tmp: false
33
34 Tools.clean()
35
36 Tools.checkout( commit )
37 }
38
39 // Update the build directories when exiting the node
40 BuildDir = pwd tmp: true
41 SrcDir = pwd tmp: false
42 }
43 }
44
45 //If an exception is caught we need to change the status and remember to
46 //attach the build log to the email
47 // catch (Exception caughtError) {
48 // //rethrow error later
49 // err = caughtError
50
51 // echo err.toString()
52
53 // //An error has occured, the build log is relevent
54 // log_needed = true
55
56 // //Store the result of the build log
57 // currentBuild.result = "${StageName} FAILURE".trim()
58 // }
59
60 finally {
61 // //Send email with final results if this is not a full build
62 // email(log_needed)
63
64 // echo 'Distribution Completed'
65
66 // /* Must re-throw exception to propagate error */
67 // if (err) {
68 // throw err
69 // }
70 }
71}
72
73//===========================================================================================================
74// Main compilation routines
75//===========================================================================================================
76
77
78//Compilation script is done here but environnement set-up and error handling is done in main loop
79// def checkout() {
80// build_stage('Checkout', true) {
81// //checkout the source code and clean the repo
82// final scmVars = checkout scm
83// Settings.GitNewRef = scmVars.GIT_COMMIT
84// Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
85
86// echo GitLogMessage()
87// }
88// }
89
90//===========================================================================================================
91// Helper classes/variables/routines
92//===========================================================================================================
93def prepare_build() {
94 // prepare the properties
95 properties ([ \
96 buildDiscarder(logRotator( \
97 artifactDaysToKeepStr: '', \
98 artifactNumToKeepStr: '', \
99 daysToKeepStr: '730', \
100 numToKeepStr: '1000' \
101 )), \
102 [$class: 'ParametersDefinitionProperty', \
103 parameterDefinitions: [ \
104 [$class: 'StringParameterDefinition', \
105 description: 'The git commit to checkout', \
106 name: 'GitRef', \
107 defaultValue: '', \
108 ], \
109 ],
110 ]])
111
112 // It's unfortunate but it looks like we need to checkout the entire repo just to get
113 // - the pretty git printer
114 // - Jenkins.tools
115 checkout scm
116
117 Tools = load "Jenkins/tools.groovy"
118
119 currentBuild.description = "Distributing Tarball"
120 def ref = params.GitRef ? params.GitRef : "HEAD"
121 echo "Distributing git commit ${ref}"
122
123 return params.GitRef
124}
125
Note: See TracBrowser for help on using the repository browser.