source: Jenkins/Distribute@ 4011b98

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 4011b98 was 4011b98, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

First pieces of distribute jenkins script

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