Skip to content

Commit 3002c8c

Browse files
authored
Merge pull request #996 from splunk/data_source_improvement
Data source improvement
2 parents 980d8f6 + 99a81fb commit 3002c8c

File tree

1,142 files changed

+11236
-7159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,142 files changed

+11236
-7159
lines changed

.github/validate_dataset_ymls.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/validate.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Validate Attack Data
2+
3+
on:
4+
pull_request:
5+
branches: [ master, main ]
6+
types: [opened, synchronize, reopened]
7+
paths:
8+
- 'datasets/**/*.yml'
9+
- 'datasets/**/*.yaml'
10+
- 'bin/validate.py'
11+
- 'bin/dataset_schema.json'
12+
- 'bin/requirements.txt'
13+
push:
14+
branches: [ master, main ]
15+
paths:
16+
- 'datasets/**/*.yml'
17+
- 'datasets/**/*.yaml'
18+
- 'bin/validate.py'
19+
- 'bin/dataset_schema.json'
20+
- 'bin/requirements.txt'
21+
22+
permissions:
23+
contents: read
24+
issues: write
25+
pull-requests: write
26+
27+
jobs:
28+
validate-attack-data:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
with:
35+
lfs: true
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v4
39+
with:
40+
python-version: '3.9'
41+
cache: 'pip'
42+
43+
- name: Install dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
pip install -r bin/requirements.txt
47+
48+
# Validate all YAML files
49+
- name: Validate all YAML files
50+
run: |
51+
python bin/validate.py
52+
env:
53+
PYTHONPATH: ${{ github.workspace }}/bin
54+
55+
# PR-specific success/failure handling
56+
- name: Comment PR on validation failure
57+
if: failure() && github.event_name == 'pull_request'
58+
uses: actions/github-script@v7
59+
with:
60+
script: |
61+
const { owner, repo, number } = context.issue;
62+
63+
const body = `❌ **Attack Data Validation Failed**
64+
65+
The YAML files in this PR do not pass validation. Please check the workflow logs for detailed error messages and fix the issues before merging.
66+
67+
[View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})`;
68+
69+
await github.rest.issues.createComment({
70+
owner,
71+
repo,
72+
issue_number: number,
73+
body: body
74+
});
75+
76+
- name: Comment PR on validation success
77+
if: success() && github.event_name == 'pull_request'
78+
uses: actions/github-script@v7
79+
with:
80+
script: |
81+
const { owner, repo, number } = context.issue;
82+
83+
const body = `✅ **Attack Data Validation Passed**
84+
85+
All YAML files in this PR have been successfully validated against the schema.
86+
87+
Ready for review and merge! 🚀`;
88+
89+
await github.rest.issues.createComment({
90+
owner,
91+
repo,
92+
issue_number: number,
93+
body: body
94+
});
95+
96+
# Push-specific failure handling (create issue)
97+
- name: Create issue on validation failure (Push)
98+
if: failure() && github.event_name == 'push'
99+
uses: actions/github-script@v7
100+
with:
101+
script: |
102+
const title = `🚨 Attack Data Validation Failed - ${new Date().toISOString().split('T')[0]}`;
103+
const body = `**Validation failed on push to ${context.ref}**
104+
105+
Commit: ${context.sha}
106+
107+
The YAML files in the datasets directory do not pass validation. This indicates that invalid data has been merged into the main branch.
108+
109+
**Action Required:**
110+
1. Review the [failed workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
111+
2. Fix the validation errors
112+
3. Create a hotfix PR to resolve the issues
113+
`;
114+
115+
await github.rest.issues.create({
116+
owner: context.repo.owner,
117+
repo: context.repo.repo,
118+
title: title,
119+
body: body,
120+
labels: ['bug', 'validation-failure', 'high-priority']
121+
});
122+
123+

bin/add_uuid.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)