source: Jenkins/Distribute@ 6b293bd

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

Like Cforall, groovy does not support tuple assign and tuple declaration in the same statement.

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[4011b98]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
[6b293bd]28 final commit, build
29 (commit, build) = prepare_build()
[4011b98]30
31 node('x64') {
32 BuildDir = pwd tmp: true
33 SrcDir = pwd tmp: false
34
[6c9e0bc]35 Tools.Clean()
[4011b98]36
[6c9e0bc]37 Tools.Checkout( commit )
[8fe6040]38
39 final version = GetVersion( build )
[4011b98]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
[cf2257f]50 // catch (Exception caughtError) {
[4011b98]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()
[cf2257f]61 // }
[4011b98]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//===========================================================================================================
[8fe6040]79def GetVersion(build) {
80 final pver = "sed 's/AC_INIT(\[cfa-cc\],\[\(.*\)\],\[cforall@plg.uwaterloo.ca\])/\1/;t;d' ${SrcDir} configure.ac"
81 final version = "${pver}.${build}"
[f78ead5]82
[8fe6040]83 echo "Package Version: ${pver}"
84 echo "Build Version: ${build}"
85 echo "Long Version: ${version}"
[4011b98]86
[8fe6040]87 return version
88}
[4011b98]89
90
91//===========================================================================================================
92// Helper classes/variables/routines
93//===========================================================================================================
94def prepare_build() {
95 // prepare the properties
96 properties ([ \
97 buildDiscarder(logRotator( \
98 artifactDaysToKeepStr: '', \
99 artifactNumToKeepStr: '', \
100 daysToKeepStr: '730', \
101 numToKeepStr: '1000' \
102 )), \
103 [$class: 'ParametersDefinitionProperty', \
104 parameterDefinitions: [ \
[782d479]105 [$class: 'StringParameterDefinition', \
[c3d3c22]106 description: 'The git commit to checkout', \
107 name: 'GitRef', \
[782d479]108 defaultValue: '', \
[4011b98]109 ], \
[8fe6040]110 [$class: 'StringParameterDefinition', \
111 description: 'Build Number to put into the version', \
112 name: 'Build', \
113 defaultValue: '0', \
114 ], \
[4011b98]115 ],
116 ]])
117
[4b138dd]118 // It's unfortunate but it looks like we need to checkout the entire repo just to get
119 // - the pretty git printer
120 // - Jenkins.tools
121 checkout scm
122
123 Tools = load "Jenkins/tools.groovy"
124
[c3d3c22]125 currentBuild.description = "Distributing Tarball"
126 def ref = params.GitRef ? params.GitRef : "HEAD"
127 echo "Distributing git commit ${ref}"
[f78ead5]128
[8fe6040]129 return [params.GitRef, params.Build]
[6855d14]130}
[4011b98]131
Note: See TracBrowser for help on using the repository browser.