1+ @Library (' jenkins-shared-libraries' ) _
2+ def ENV_LOC = [:]
3+ pipeline {
4+ parameters {
5+ choice(name : ' PLATFORM_FILTER' , choices : [' all' , ' windows-java-samples' , ' mac-arm-java-samples' , ' linux-java-samples' ], description : ' Run on specific platform' )
6+ booleanParam defaultValue : false , description : ' Completely clean the workspace before building, including the Conan cache' , name : ' CLEAN_WORKSPACE'
7+ booleanParam defaultValue : false , description : ' Run clean-samples' , name : ' DISTCLEAN'
8+ }
9+ options{
10+ buildDiscarder logRotator(artifactDaysToKeepStr : ' 4' , artifactNumToKeepStr : ' 10' , daysToKeepStr : ' 7' , numToKeepStr : ' 10' )
11+ disableConcurrentBuilds()
12+ timeout(time : 4 , unit : " HOURS" )
13+ }
14+ agent none
15+ triggers {
16+ // From the doc: @midnight actually means some time between 12:00 AM and 2:59 AM.
17+ // This gives us automatic spreading out of jobs, so they don't cause load spikes.
18+ cron(' @midnight' )
19+ }
20+ stages {
21+ stage(' Matrix stage' ) {
22+ matrix {
23+ agent {
24+ label " ${ NODE} "
25+ }
26+ when { anyOf {
27+ expression { params. PLATFORM_FILTER == ' all' }
28+ expression { params. PLATFORM_FILTER == env. NODE }
29+ } }
30+ axes {
31+ axis {
32+ name ' NODE'
33+ values ' windows-java-samples' , ' mac-arm-java-samples' , ' linux-java-samples'
34+ }
35+ }
36+ environment {
37+ CONAN_USER_HOME = " ${ WORKSPACE} "
38+ CONAN_NON_INTERACTIVE = ' 1'
39+ CONAN_PRINT_RUN_COMMANDS = ' 1'
40+ }
41+ stages {
42+ stage(' Axis' ){
43+ steps {
44+ printPlatformNameInStep()
45+ }
46+ }
47+ stage(' Clean/reset Git checkout for release' ) {
48+ when {
49+ expression {
50+ params. CLEAN_WORKSPACE
51+ }
52+ }
53+ steps {
54+ echo " Clean ${ NODE} "
55+ script {
56+ // Ensure that the checkout is clean and any changes
57+ // to .gitattributes and .gitignore have been taken
58+ // into effect
59+ if (isUnix()) {
60+ sh """
61+ git rm -f -q -r .
62+ git reset --hard HEAD
63+ git clean -fdx
64+ """
65+ } else {
66+ // On Windows, 'git clean' can't handle long paths in .conan,
67+ // so remove that first.
68+ bat """
69+ if exist ${ WORKSPACE} \\ .conan\\ rmdir/s/q ${ WORKSPACE} \\ .conan
70+ git rm -q -r .
71+ git reset --hard HEAD
72+ git clean -fdx
73+ """
74+ }
75+ }
76+ }
77+ }
78+ }
79+ }
80+ }
81+ }
82+ }
0 commit comments