Skip to content

Commit 2797a70

Browse files
authored
INSTALL-944: Apply latest enhancements to the CI pipeline (#686)
Update the CI pipeline with the latest enhancements of the shared library
1 parent 735a566 commit 2797a70

File tree

10 files changed

+79
-467
lines changed

10 files changed

+79
-467
lines changed

Jenkinsfile

+54-53
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,13 @@
1111
*/
1212

1313
/**
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.
14+
* Hold information about the pipeline.
1815
*/
19-
void runBuildStage(String buildMode, String linkMode) {
20-
String cmd = "python3 ${env.WORKSPACE}/resources/ci_cd/linux_build.py"
21-
cmd += " --build-mode ${buildMode}"
22-
cmd += " --link-mode ${linkMode}"
23-
cmd += " --build-dir ${getBuildDirectory(buildMode, linkMode)}"
24-
command.run(cmd)
25-
}
26-
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) {
34-
return "build_${buildMode}_${linkMode}"
35-
}
16+
Map pipelineInfo = [:]
3617

3718
pipeline {
3819
agent {
39-
label "${nodeManager.labelFromJobName()}"
20+
label "${runInsideExecutor.labelFromJobName()}"
4021
}
4122

4223
options {
@@ -61,29 +42,32 @@ pipeline {
6142
timeout(time: 2, unit: 'HOURS')
6243
}
6344

64-
environment {
65-
RTI_INSTALLATION_PATH = "${env.WORKSPACE}"
66-
VIRTUAL_ENV = "${env.WORKSPACE}/.venv"
67-
}
68-
6945
stages {
70-
stage('Download Packages') {
46+
stage('Configuration') {
7147
steps {
7248
script {
73-
nodeManager.runInsideExecutor() {
74-
command.run(
75-
'pip3 install -r resources/ci_cd/requirements.txt'
49+
pipelineInfo.dockerDir = "${env.WORKSPACE}/resources/docker/"
50+
pipelineInfo.staticAnalysisDir = "${env.WORKSPACE}/static_analysis_report"
51+
runInsideExecutor(
52+
'',
53+
pipelineInfo.dockerDir,
54+
) {
55+
pipelineInfo.connextArch = getEnvVar('CONNEXTDDS_ARCH')
56+
}
57+
}
58+
}
59+
}
60+
stage('Download Packages') {
61+
steps {
62+
runInsideExecutor(
63+
'',
64+
pipelineInfo.dockerDir,
65+
) {
66+
script {
67+
pipelineInfo.connextDir = installConnext(
68+
pipelineInfo.connextArch,
69+
env.WORKSPACE,
7670
)
77-
withAWSCredentials {
78-
withCredentials([
79-
string(credentialsId: 's3-bucket', variable: 'RTI_AWS_BUCKET'),
80-
string(credentialsId: 's3-path', variable: 'RTI_AWS_PATH'),
81-
]) {
82-
command.run(
83-
'python3 resources/ci_cd/linux_install.py -a $CONNEXTDDS_ARCH'
84-
)
85-
}
86-
}
8771
}
8872
}
8973
}
@@ -103,11 +87,18 @@ pipeline {
10387
stages {
10488
stage('Build single mode') {
10589
steps {
106-
script{
107-
nodeManager.runInsideExecutor() {
108-
echo("Build ${buildMode}/${linkMode}")
109-
runBuildStage(buildMode, linkMode)
110-
}
90+
runInsideExecutor(
91+
'',
92+
pipelineInfo.dockerDir,
93+
) {
94+
echo("Building ${buildMode}/${linkMode}")
95+
buildExamples(
96+
pipelineInfo.connextArch,
97+
pipelineInfo.connextDir,
98+
buildMode,
99+
linkMode,
100+
env.WORKSPACE,
101+
)
111102
}
112103
}
113104
}
@@ -116,14 +107,24 @@ pipeline {
116107
}
117108
stage('Static Analysis') {
118109
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-
}
110+
runInsideExecutor(
111+
'',
112+
pipelineInfo.dockerDir,
113+
) {
114+
runStaticAnalysis(
115+
buildExamples.getBuildDirectory('release', 'dynamic'),
116+
pipelineInfo.connextDir,
117+
pipelineInfo.staticAnalysisDir,
118+
)
126119
}
120+
publishHTML(target: [
121+
allowMissing: true,
122+
alwaysLinkToLastBuild: true,
123+
keepAll: true,
124+
reportDir: pipelineInfo.staticAnalysisDir,
125+
reportFiles: 'index.html',
126+
reportName: 'LLVM Scan build static analysis',
127+
])
127128
}
128129
}
129130
}

examples/connext_dds/network_capture/03_security/c/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ find_package(RTIConnextDDS
2424
security_plugins
2525
)
2626

27-
if(NOT RTIConnextDDS::security_plugins)
27+
if(NOT TARGET RTIConnextDDS::security_plugins)
2828
message(WARNING "RTIConnextDDS::security_plugins component is missing. Skipping example")
2929
return()
3030
endif()

examples/connext_dds/network_capture/04_advanced_api/c/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ find_package(RTIConnextDDS
2424
security_plugins
2525
)
2626

27-
if(NOT RTIConnextDDS::security_plugins)
27+
if(NOT TARGET RTIConnextDDS::security_plugins)
2828
message(WARNING "RTIConnextDDS::security_plugins component is missing. Skipping example")
2929
return()
3030
endif()

resources/ci_cd/README.md

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
# Use full automation scripts
22

3-
The scripts contained in this directory are primarily intended for CI/CD
4-
services, as Jenkins or GitHub Actions. As a summary, we currently have the
5-
following files:
3+
The scripts contained in this directory are primarily intended for GitHub
4+
Actions CI. As a summary, we currently have the following files:
65

76
- `linux_format.py`: allows to check the linting of various files within the
87
repository: Python, Markdown and C/C++ source code files.
98

10-
- `linux_install.py`: performs an installation of a minimun RTI ConnextDDS
11-
package to build and perform static analysis of the examples.
12-
13-
- `linux_build.py`: build all the `C/C++` examples using `CMake`.
14-
15-
- `linux_static_analysis.py`: run static analysis. This should be called
16-
after building all the examples.
17-
18-
- `jenkins_output.py`: generate a `Markdown` file from the template located
19-
in `resources/markdown_templates/JenkinsTemplate.md` which contains the
20-
details text for the GitHub check.
21-
229
- `diff_clang_format.sh`: this is a helper script used in `linux_format.py`
2310
to run diffs between the source code and the `clang-format`'s changes to
2411
the same source code.
2512

2613
For `linux_format.py` you will also need the [*Black*] Python package,
2714
[*clang-format*] tool and the [*markdownlint-cli*] utility.
2815

29-
[*scan-build*]: https://pypi.org/project/scan-build/
3016
[*clang-format*]: https://pypi.org/project/clang-format/9.0.0/
3117
[*Black*]: https://pypi.org/project/black/
3218
[*markdownlint-cli*]: https://www.npmjs.com/package/markdownlint-cli/v/0.23.1

resources/ci_cd/linux_build.py

-162
This file was deleted.

0 commit comments

Comments
 (0)