10
10
* to use the software.
11
11
*/
12
12
13
- def runBuildStage (String buildMode , String linkMode ) {
14
- def cmd = " python3 ${ env.WORKSPACE} /resources/ci_cd/linux_build.py"
13
+ /**
14
+ * Build the examples in the specified build and link modes.
15
+ *
16
+ * @param buildMode The build mode name.
17
+ * @param linkMode The link mode name.
18
+ */
19
+ void runBuildStage (String buildMode , String linkMode ) {
20
+ String cmd = " python3 ${ env.WORKSPACE} /resources/ci_cd/linux_build.py"
15
21
cmd + = " --build-mode ${ buildMode} "
16
22
cmd + = " --link-mode ${ linkMode} "
17
- cmd + = " --build-dir ${ get_build_directory (buildMode, linkMode)} "
18
- sh (cmd)
23
+ cmd + = " --build-dir ${ getBuildDirectory (buildMode, linkMode)} "
24
+ command . run (cmd)
19
25
}
20
26
21
- def get_build_directory (String buildMode , String linkMode ) {
27
+ /**
28
+ * Craft the build directory name.
29
+ *
30
+ * @param buildMode The build mode name.
31
+ * @param linkMode The link mode name.
32
+ */
33
+ String getBuildDirectory (String buildMode , String linkMode ) {
22
34
return " build_${ buildMode} _${ linkMode} "
23
35
}
24
36
25
37
pipeline {
26
- agent none
38
+ agent {
39
+ label " ${ nodeManager.labelFromJobName()} "
40
+ }
27
41
28
42
options {
29
43
disableConcurrentBuilds()
@@ -47,71 +61,76 @@ pipeline {
47
61
timeout(time : 2 , unit : ' HOURS' )
48
62
}
49
63
50
- stages {
51
- stage(' Build sequence' ) {
52
- agent {
53
- dockerfile {
54
- filename ' resources/docker/Dockerfile.linux'
55
- label ' docker'
56
- }
57
- }
58
-
59
- environment {
60
- RTI_INSTALLATION_PATH = " ${ env.WORKSPACE} "
61
- }
62
-
63
- stages {
64
- stage(' Download Packages' ) {
65
- steps {
66
- sh ' pip3 install -r resources/ci_cd/requirements.txt'
64
+ environment {
65
+ RTI_INSTALLATION_PATH = " ${ env.WORKSPACE} "
66
+ VIRTUAL_ENV = " ${ env.WORKSPACE} /.venv"
67
+ }
67
68
69
+ stages {
70
+ stage(' Download Packages' ) {
71
+ steps {
72
+ script {
73
+ nodeManager. runInsideExecutor() {
74
+ command. run(
75
+ ' pip3 install -r resources/ci_cd/requirements.txt'
76
+ )
68
77
withAWSCredentials {
69
78
withCredentials([
70
79
string(credentialsId : ' s3-bucket' , variable : ' RTI_AWS_BUCKET' ),
71
80
string(credentialsId : ' s3-path' , variable : ' RTI_AWS_PATH' ),
72
81
]) {
73
- sh ' python3 resources/ci_cd/linux_install.py -a $CONNEXTDDS_ARCH'
82
+ command. run(
83
+ ' python3 resources/ci_cd/linux_install.py -a $CONNEXTDDS_ARCH'
84
+ )
74
85
}
75
86
}
76
87
}
77
88
}
78
-
79
- stage(' Build all modes' ) {
80
- matrix {
81
- axes {
82
- axis {
83
- name ' buildMode'
84
- values ' release' , ' debug'
85
- }
86
- axis {
87
- name ' linkMode'
88
- values ' static' , ' dynamic'
89
- }
90
- }
91
- stages {
92
- stage(' Build single mode' ) {
93
- steps {
89
+ }
90
+ }
91
+ stage(' Build all modes' ) {
92
+ matrix {
93
+ axes {
94
+ axis {
95
+ name ' buildMode'
96
+ values ' release' , ' debug'
97
+ }
98
+ axis {
99
+ name ' linkMode'
100
+ values ' static' , ' dynamic'
101
+ }
102
+ }
103
+ stages {
104
+ stage(' Build single mode' ) {
105
+ steps {
106
+ script{
107
+ nodeManager. runInsideExecutor() {
94
108
echo(" Build ${ buildMode} /${ linkMode} " )
95
109
runBuildStage(buildMode, linkMode)
96
110
}
97
111
}
98
112
}
99
113
}
100
114
}
101
-
102
- stage(' Static Analysis' ) {
103
- steps {
104
- sh " python3 resources/ci_cd/linux_static_analysis.py --build-dir ${ get_build_directory('release', 'dynamic')} "
105
- }
106
- }
107
115
}
108
-
109
- post {
110
- cleanup {
111
- cleanWs()
116
+ }
117
+ stage(' Static Analysis' ) {
118
+ steps {
119
+ script {
120
+ nodeManager. runInsideExecutor() {
121
+ command. run("""
122
+ python3 resources/ci_cd/linux_static_analysis.py \
123
+ --build-dir ${ getBuildDirectory('release', 'dynamic')}
124
+ """ )
125
+ }
112
126
}
113
127
}
114
128
}
115
129
}
130
+ post {
131
+ cleanup {
132
+ cleanWs()
133
+ }
134
+ }
116
135
}
117
136
0 commit comments