-
Notifications
You must be signed in to change notification settings - Fork 269
/
azure-pipelines.yml
191 lines (170 loc) · 4.97 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
- master
jobs:
- job: Tests
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python37:
python.version: '3.7'
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
displayName: 'Install pip'
- script: |
pip install .
find roadtools/ -name '*.py' -exec python -m py_compile {} \;
displayName: 'Install ROADlib'
workingDirectory: roadlib
- script: |
pip install .
pip install neo4j-driver
find roadtools/ -name '*.py' -exec python -m py_compile {} \;
displayName: 'Install ROADrecon'
workingDirectory: roadrecon
- script: |
pip install .
find roadtools/ -name '*.py' -exec python -m py_compile {} \;
displayName: 'Install roadtx'
workingDirectory: roadtx
- script: |
set -e
roadrecon -h
roadrecon-gui -h
roadrecon plugin bloodhound -h
roadrecon auth -u $rtuser -p $rtpass
roadrecon dump
roadrecon plugin policies
roadrecon plugin xlsexport
rm .roadtools_auth
rm caps.html
displayName: 'Run ROADrecon gathering tests'
env:
rtuser: $(rtuser)
rtpass: $(rtpass)
- script: |
set -e
roadtx -h
roadtx gettokens -u $rtuser -p $rtpass
roadtx gettokens -u $rtuser -p $rtpass -c azcli -r azrm
roadtx gettokens --refresh-token file -c msteams
rm .roadtools_auth
displayName: 'Run basic roadtx tests'
env:
rtuser: $(rtuser)
rtpass: $(rtpass)
- script: |
set -e
roadtx gettokens -u $rtuser -p $rtpass -r drs
roadtx device -a join -c pipeline.pem -k pipeline.key
retry_if_fail() {
set +e
local exit_code=0
for i in 1 2 3 4 5; do
"$@"
exit_code=$?
if [ $exit_code -eq 0 ]; then
break
fi
if [ $i -lt 5 ]; then
sleep 10s
fi
done
set -e
return $exit_code
}
retry_if_fail roadtx prt -a request -c pipeline.pem -k pipeline.key -u $rtuser -p $rtpass >/dev/null
retry_if_fail roadtx prtauth
retry_if_fail roadtx prt -a renew >/dev/null
retry_if_fail roadtx prtauth -c azcli -r azrm
roadtx device -a delete -c pipeline.pem -k pipeline.key
rm .roadtools_auth pipeline.pem pipeline.key
displayName: 'Run roadtx device tests'
env:
rtuser: $(rtuser)
rtpass: $(rtpass)
- script: |
pip install pytest pytest-flask
py.test tests/
displayName: 'Run ROADrecon API tests'
- job: Build
dependsOn: Tests
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
displayName: 'Use Python 3.8'
- task: Npm@1
inputs:
command: 'install'
workingDir: 'roadrecon/frontend/'
- task: Npm@1
inputs:
command: 'custom'
workingDir: 'roadrecon/frontend/'
customCommand: 'run build -- --configuration production'
- script: |
pip install --upgrade setuptools wheel
displayName: 'Update setuptools'
- script: |
pip install .
python setup.py sdist
python setup.py bdist_wheel
displayName: 'Create roadlib package'
workingDirectory: roadlib
- script: |
pip install .
python setup.py sdist
python setup.py bdist_wheel
displayName: 'Create ROADrecon package'
workingDirectory: roadrecon
- script: |
pip install .
python setup.py sdist
python setup.py bdist_wheel
displayName: 'Create roadtx package'
workingDirectory: roadtx
- task: CopyFiles@2
displayName: 'Copy ROADrecon Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: 'roadrecon/dist/'
Contents: '*'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: CopyFiles@2
displayName: 'Copy ROADlib Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: 'roadlib/dist/'
Contents: '*'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: CopyFiles@2
displayName: 'Copy roadtx Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: 'roadtx/dist/'
Contents: '*'
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ROADtools