-
Notifications
You must be signed in to change notification settings - Fork 5
/
cloudbuild.test.yaml
124 lines (115 loc) · 2.95 KB
/
cloudbuild.test.yaml
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
steps:
# SETUP SSH KEYS
- name: 'gcr.io/cloud-builders/git'
id: set-ssh-keys
secretEnv: ['SSH_KEY']
entrypoint: 'bash'
args:
- -c
- |
echo "$$SSH_KEY" >> /root/.ssh/id_rsa
chmod 400 /root/.ssh/id_rsa
cp known_hosts.github /root/.ssh/known_hosts
git config --global user.email "ops@limacharlie.io"
git config --global user.name "LimaCharlie Ops"
volumes:
- name: 'ssh'
path: /root/.ssh
# CLONE NECESSARY REPOS
- name: 'gcr.io/cloud-builders/git'
id: clone-repo-sigma
waitFor: ['set-ssh-keys']
args:
- clone
- --recurse-submodules
- git@github.com:SigmaHQ/sigma.git
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
id: clone-repo-sigma-legacy
waitFor: ['set-ssh-keys']
args:
- clone
- --recurse-submodules
- git@github.com:SigmaHQ/legacy-sigmatools.git
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
id: clone-repo-sigma-limacharlie
waitFor: ['set-ssh-keys']
args:
- clone
- --recurse-submodules
- git@github.com:refractionPOINT/sigma-limacharlie.git
- -b
- rules
volumes:
- name: 'ssh'
path: /root/.ssh
# RESET EXISTING RULES
- name: 'gcr.io/cloud-builders/git'
id: reset-latest
waitFor: ['clone-repo-sigma', 'clone-repo-sigma-legacy', 'clone-repo-sigma-limacharlie']
dir: sigma-limacharlie
entrypoint: 'bash'
args:
- -c
- |
git rm -r ./latest || true
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
id: reset-experimental
waitFor: ['clone-repo-sigma', 'clone-repo-sigma-legacy', 'clone-repo-sigma-limacharlie']
dir: sigma-limacharlie
entrypoint: 'bash'
args:
- -c
- |
git rm -r ./experimental || true
volumes:
- name: 'ssh'
path: /root/.ssh
# GENERATE NEW RULES
- name: python:3
id: generate-latest
waitFor: ['reset-latest']
entrypoint: 'bash'
args:
- -c
- |
pip3 install ruamel.yaml pyyaml requests termcolor
python3 ./scripts/generate_all.py ./sigma/ ./legacy-sigmatools/ ./sigma-limacharlie/latest/ windows/builtin windows/process_creation windows/sysmon
# GENERATE NEW EXPERIMENTAL RULES
- name: python:3
id: generate-experimental
waitFor: ['reset-experimental']
entrypoint: 'bash'
args:
- -c
- |
pip3 install ruamel.yaml pyyaml requests termcolor
python3 ./scripts/generate_all.py ./sigma/ ./legacy-sigmatools/ ./sigma-limacharlie/experimental/ windows/builtin windows/process_creation windows/sysmon windows/dns_query macos/file_event macos/process_creation linux/process_creation
# PUSH CHANGES
- name: 'gcr.io/cloud-builders/git'
id: push-changes
waitFor: ['generate-latest', 'generate-experimental']
dir: sigma-limacharlie
entrypoint: 'bash'
args:
- -c
- |
ls -lahR
volumes:
- name: 'ssh'
path: /root/.ssh
availableSecrets:
secretManager:
- versionName: projects/968258204747/secrets/sigma-deploykey/versions/latest
env: 'SSH_KEY'
timeout: 3600s
options:
machineType: 'N1_HIGHCPU_8'