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-instant
112 lines (87 loc) · 2.77 KB
/
Jenkinsfile-instant
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
#!groovy
/**
* Jenkinsfile for Wazuh
* Copyright (C) 2016 Wazuh Inc.
* June 22, 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 = ['centos-7-slave', 'debian-jessie-slave']
//Stage checkout source
def check_source(label){
checkout scm
}
//Stage unit tests
def unit_tests(label){
dir('src'){
sh 'sudo make --warn-undefined-variables test_valgrind'
sh 'sudo make clean'
}
}
//Stage standard ossec compilations
def standard_compilations(label){
dir ('src') {
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'
}
}
//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') {
sh 'sudo make --warn-undefined-variables V=1 TARGET=local install'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
sh 'sudo make --warn-undefined-variables 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) {
sh 'sudo make --warn-undefined-variables V=1 TARGET=server '+optionX+' '+optionY+' install'
sh 'sudo make clean && sudo rm -rf /var/ossec/'
}
}
}
}
//Stage windows compilation
def windows_compilation(label){
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)
}
}
}
}