-
Notifications
You must be signed in to change notification settings - Fork 193
/
azure-pipelines.yml
91 lines (83 loc) · 2.55 KB
/
azure-pipelines.yml
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
# Build/CI checker for Microsoft Sentinel Notebooks
trigger:
- master
pr:
- master
schedules:
- cron: 0 4 * * 1
branches:
include:
- master
always: true
jobs:
- job: PythonTests
displayName: Python install and test Notebooks
strategy:
matrix:
Python310:
python.version: '3.10'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- task: Cache@2
displayName: Cache pip packages
continueOnError: True
inputs:
key: requirements.txt
restoreKeys: python
path: $(PIP_CACHE_DIR)
- script: |
python -m pip install --upgrade ipykernel
python -m pip install --upgrade pip wheel
python -m pip install --upgrade msticpy
python -m pip install -r requirements.txt
displayName: 'Install dependencies'
- script: |
python -m utils.check_nb_kernel check -p "*.ipynb"
displayName: 'Kernelspec check'
- script: |
python -m pip install nbconvert
nbconver_opts="--ExecutePreprocessor.timeout=60 --ExecutePreprocessor.kernel_name=python3 --log-level 20 --allow-errors --to notebook"
mkdir -p $(System.DefaultWorkingDirectory)/nb_output
nbconver_opts="$nbconver_opts --output-dir=$(System.DefaultWorkingDirectory)/nb_output"
jupyter nbconvert $nbconver_opts --execute "Machine Learning in Notebooks Examples.ipynb"
tour_nb="A Tour of Cybersec notebook features.ipynb"
if [[ -f "$tour_nb" ]]
then
jupyter nbconvert $nbconver_opts --execute "$tour_nb"
fi
displayName: AutorunNotebooks
- script: |
logfile=url_with_locales.log
locale_match="(docs.microsoft.com|azure.microsoft.com)(\/[a-z]{2}-[a-z]{2})"
grep --directories=recurse -E -n --exclude=*.pkl --exclude=*.log $locale_match * > $logfile
if [ -s $logfile ]
then
echo Locale-specific URLS found in one or more files.
echo Please replace with locale-agnostic versions
cat $logfile
exit 1
fi
displayName: 'URL Locale check'
- job: SecurityChecks
displayName: Security check
pool:
vmImage: 'windows-latest'
steps:
- task: AntiMalware@4
inputs:
InputType: 'Basic'
ScanType: 'CustomScan'
FileDirPath: '$(Build.StagingDirectory)'
TreatSignatureUpdateFailureAs: 'Warning'
SignatureFreshness: 'UpToDate'
TreatStaleSignatureAs: 'Error'
- task: CredScan@3
- task: SdtReport@2
- task: PostAnalysis@2
inputs:
GdnBreakAllTools: true