This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
forked from wazuh/wazuh
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile-daily
138 lines (110 loc) · 4.04 KB
/
Jenkinsfile-daily
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!groovy
/**
* Jenkinsfile for Wazuh
* Copyright (C) 2016 Wazuh Inc.
* November 19, 2016.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License (version 2) as published by the FSF - Free Software
* Foundation.
*/
def labels = ['ubuntu-xenial-slave', 'ubuntu-trusty-slave', 'ubuntu-precise-slave', 'debian-jessie-slave', 'debian-wheezy-slave', 'centos-7-slave', 'centos-6-slave', 'centos-5-slave']
//Stage checkout source
def check_source(label){
checkout scm
}
//Stage unit tests
def unit_tests(label){
if( label != 'centos-6-slave' && label != 'centos-5-slave'){
dir('src'){
sh 'sudo make --warn-undefined-variables test_valgrind'
sh 'sudo make clean'
}
}
}
//Stage standard ossec compilations
def standard_compilations(label){
dir ('src') {
if( label != 'centos-5-slave'){
sh 'sudo make --warn-undefined-variables V=1 TARGET=agent install'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
sh 'sudo make --warn-undefined-variables V=1 TARGET=server install'
sh 'sudo make clean'
} else{
sh 'sudo make --warn-undefined-variables USE_LEGACY_SSL=yes V=1 TARGET=agent install'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
sh 'sudo make --warn-undefined-variables USE_LEGACY_SSL=yes V=1 TARGET=server install'
sh 'sudo make clean'
}
}
}
//Stage rule tests
def rule_tests(label){
dir ('src') {
sh 'sudo make V=1 TARGET=server test-rules'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
}
}
//Stage advanced ossec compilation
def advanced_compilations(label){
dir ('src') {
if( label != 'centos-5-slave'){
sh 'sudo make --warn-undefined-variables V=1 TARGET=local install'
} else {
sh 'sudo make --warn-undefined-variables USE_LEGACY_SSL=yes V=1 TARGET=local install'
}
sh 'sudo make clean && sudo rm -rf /var/ossec/'
if( label != 'centos-5-slave'){
sh 'sudo make --warn-undefined-variables V=1 TARGET=hybrid install'
} else {
sh 'sudo make --warn-undefined-variables USE_LEGACY_SSL=yes V=1 TARGET=hybrid install'
}
sh 'sudo make clean && sudo rm -rf /var/ossec/'
def matrixOptionsX = ['DATABASE=none', 'DATABASE=pgsql', 'DATABASE=mysql']
def matrixOptionsY = ['USE_GEOIP=1', '']
for (optionX in matrixOptionsX){
for (optionY in matrixOptionsY) {
if( label != 'centos-5-slave'){
sh 'sudo make --warn-undefined-variables V=1 TARGET=server '+optionX+' '+optionY+' install'
} else {
sh 'sudo make --warn-undefined-variables USE_LEGACY_SSL=yes V=1 TARGET=server '+optionX+' '+optionY+' install'
}
sh 'sudo make clean && sudo rm -rf /var/ossec/'
}
}
}
}
//Stage windows compilation
def windows_compilation(label){
if(label != 'ubuntu-precise-slave' && label != 'debian-wheezy-slave' && label != 'centos-5-slave'){
dir ('src') {
sh 'sudo make --warn-undefined-variables TARGET=winagent'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
}
}
}
for (label in labels) {
stage (label){
node(label) {
stage ('Checkout SCM'){
check_source(label)
}
stage ('Unit Tests'){
unit_tests(label)
}
stage ('Standard Compilations'){
standard_compilations(label)
}
stage ('Rule Tests'){
rule_tests(label)
}
stage ('Advanced Compilations'){
advanced_compilations(label)
}
stage ('Windows Compilation'){
windows_compilation(label)
}
}
}
}