-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
66 lines (59 loc) · 1.88 KB
/
build.gradle
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
task build {
group 'Build'
description 'start snort3 build container'
dependsOn 'snort3-dockers:build-time:build'
doLast {
exec {
commandLine 'python3', "${rootProject.projectDir}/scripts/start_container.py", "${rootProject.projectDir}", 'snort3-build', 'snort3-build:latest'
}
}
}
task clean {
group 'Clean'
description 'stop build container'
doLast {
exec {
commandLine 'python3', "${rootProject.projectDir}/scripts/stop_container.py", 'snort3-build'
}
}
}
task startLocalTest {
group 'Local test'
description 'local test using Kind cluster'
doLast {
// create a cluster
exec {
commandLine './scripts/setup_kind_cluster.sh', "${rootProject.projectDir}/scripts/etc/kind-cluster.yaml"
}
// create namespace
exec {
commandLine 'kubectl', 'create', 'namespace', 'snort3'
}
// create regcred for pulling images
exec {
commandLine 'kubectl', 'create', 'secret', 'docker-registry', 'regcred', '--docker-server='+System.getenv('DOCKER_SERVER'), '--docker-username='+System.getenv('DOCKER_USER'), '--docker-password='+System.getenv('DOCKER_PASSWORD'), '-n', 'snort3'
}
// install the helm chart
exec {
commandLine 'helm', 'install', 'snort3-ips-test', "${rootProject.projectDir}/helm/snort3-ips/."
}
}
}
task stopLocalTest {
group 'Local test'
description 'local test using Kind cluster'
doLast {
// unstall helm chart
exec {
commandLine 'helm', 'delete', 'snort3-ips-test'
}
// delete namespace
exec {
commandLine 'kubectl', 'delete', 'namespace', 'snort3'
}
// delete the cluster
exec {
commandLine './scripts/cleanup_kind_cluster.sh'
}
}
}