Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Azure
GitHub Repository: Azure/Azure-Sentinel-Notebooks
Path: blob/master/azure-pipelines.yml
3249 views
1
# Build/CI checker for Microsoft Sentinel Notebooks
2
3
trigger:
4
- master
5
pr:
6
- master
7
8
schedules:
9
- cron: 0 4 * * 1
10
branches:
11
include:
12
- master
13
always: true
14
jobs:
15
- job: PythonTests
16
displayName: Python install and test Notebooks
17
strategy:
18
matrix:
19
Python310:
20
python.version: '3.10'
21
pool:
22
vmImage: 'ubuntu-latest'
23
steps:
24
- task: UsePythonVersion@0
25
inputs:
26
versionSpec: '$(python.version)'
27
displayName: 'Use Python $(python.version)'
28
29
- task: Cache@2
30
displayName: Cache pip packages
31
continueOnError: True
32
inputs:
33
key: requirements.txt
34
restoreKeys: python
35
path: $(PIP_CACHE_DIR)
36
37
- script: |
38
python -m pip install --upgrade ipykernel
39
python -m pip install --upgrade pip wheel
40
python -m pip install --upgrade msticpy
41
python -m pip install -r requirements.txt
42
displayName: 'Install dependencies'
43
44
- script: |
45
python -m utils.check_nb_kernel check -p "*.ipynb"
46
displayName: 'Kernelspec check'
47
- script: |
48
python -m pip install nbconvert
49
50
nbconver_opts="--ExecutePreprocessor.timeout=60 --ExecutePreprocessor.kernel_name=python3 --log-level 20 --allow-errors --to notebook"
51
mkdir -p $(System.DefaultWorkingDirectory)/nb_output
52
nbconver_opts="$nbconver_opts --output-dir=$(System.DefaultWorkingDirectory)/nb_output"
53
jupyter nbconvert $nbconver_opts --execute "Machine Learning in Notebooks Examples.ipynb"
54
tour_nb="A Tour of Cybersec notebook features.ipynb"
55
if [[ -f "$tour_nb" ]]
56
then
57
jupyter nbconvert $nbconver_opts --execute "$tour_nb"
58
fi
59
displayName: AutorunNotebooks
60
- script: |
61
logfile=url_with_locales.log
62
locale_match="(docs.microsoft.com|azure.microsoft.com)(\/[a-z]{2}-[a-z]{2})"
63
grep --directories=recurse -E -n --exclude=*.pkl --exclude=*.log $locale_match * > $logfile
64
if [ -s $logfile ]
65
then
66
echo Locale-specific URLS found in one or more files.
67
echo Please replace with locale-agnostic versions
68
cat $logfile
69
exit 1
70
fi
71
displayName: 'URL Locale check'
72
73
- job: SecurityChecks
74
displayName: Security check
75
pool:
76
vmImage: 'windows-latest'
77
steps:
78
- task: AntiMalware@4
79
inputs:
80
InputType: 'Basic'
81
ScanType: 'CustomScan'
82
FileDirPath: '$(Build.StagingDirectory)'
83
TreatSignatureUpdateFailureAs: 'Warning'
84
SignatureFreshness: 'UpToDate'
85
TreatStaleSignatureAs: 'Error'
86
- task: CredScan@3
87
- task: SdtReport@2
88
- task: PostAnalysis@2
89
inputs:
90
GdnBreakAllTools: true
91
92
93