-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyml-to-aql.groovy
64 lines (56 loc) · 2 KB
/
yml-to-aql.groovy
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
pipeline {
agent any
environment {
GIT_REPO_URL = 'https://github.com/SigmaHQ/sigma'
}
stages {
stage('Clean Workspace') {
steps {
cleanWs()
echo "Workspace cleaned."
}
}
stage('Clone Repository') {
steps {
git branch: 'master', url: "$GIT_REPO_URL"
echo "Repository cloned: $GIT_REPO_URL"
}
}
stage('Process YAML Files') {
steps {
script {
// Find all .yml files, convert them to .aql
try {
sh '''
find "${WORKSPACE}" -name '*.yml' | while read file; do
# Set output .aql file path
aql_file="${file%.yml}.aql"
# Run the sigma conversion command for each .yml file
sigma convert -t q_radar_aql -p qradar-aql-payload "$file" -o "$aql_file" 2>&1 || true
# Check if the .aql file was successfully created
if [ -f "$aql_file" ]; then
echo "Conversion successful: $file -> $aql_file"
else
echo "Conversion failed for: $file"
fi
done
'''
} catch (e) {
echo "Warnings encountered during conversion, but continuing."
}
}
}
}
}
post {
always {
echo "Pipeline completed."
}
success {
echo "Pipeline executed successfully."
}
failure {
echo "Pipeline execution failed. Please check the logs for details."
}
}
}