-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapk_process.groovy
53 lines (44 loc) · 1.68 KB
/
apk_process.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
pipeline {
agent any
environment {
BASE_PATH = "/home/ubuntu/feature_testing/Automation_for_Malware_Detection_process"
SCRIPT_PATH = "${BASE_PATH}/main.py"
}
stages {
stage('Set Latest Paths') {
steps {
script {
def modelFile = sh(
script: """
ls ${BASE_PATH}/utilities/model/cnn_*.h5 2>/dev/null | grep -E 'cnn_[0-9]{4}-[0-9]{2}-[0-9]{2}\\.h5' | sort -t'_' -k2 -r | head -n 1
""",
returnStdout: true
).trim()
if (!modelFile) {
error("No model files matching the pattern 'cnn_YYYY-MM-DD.h5' found!")
}
env.MODEL_PATH = modelFile
// Print the latest model path for verification
echo "Latest MODEL_PATH: ${env.MODEL_PATH}"
// Find latest dataset file
env.APK_PATH = sh(
script: "ls -t ${BASE_PATH}/apk/*.apk | head -n1",
returnStdout: true
).trim()
// Print paths for verification
echo "Latest MODEL_PATH: ${env.MODEL_PATH}"
echo "Latest APK_PATH: ${env.APK_PATH}"
}
}
}
stage('Processing') {
steps {
sh '''
#!/bin/bash
. ${BASE_PATH}/venv/bin/activate
python3 ${SCRIPT_PATH} -f ${APK_PATH} -m ${MODEL_PATH}
'''
}
}
}
}