File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : App inspect tests
2
+ on :
3
+ push :
4
+ pull_request :
5
+
6
+ jobs :
7
+ deploy :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - name : Checkout
11
+ uses : actions/checkout@v2
12
+
13
+ - name : Set up Python
14
+ uses : actions/setup-python@v2
15
+ with :
16
+ python-version : ' 3.9.16'
17
+
18
+ - name : Install Splunk Packaging Toolkit
19
+ run : |
20
+ curl https://download.splunk.com/misc/packaging-toolkit/splunk-packaging-toolkit-1.0.1.tar.gz -o /tmp/spl.tar.gz
21
+ pip install /tmp/spl.tar.gz
22
+
23
+ - name : Create Splunk App Package
24
+ run : |
25
+ rm -rf .git .github .gitignore
26
+ slim package .
27
+ cp crowdsec-splunk-app-*.tar.gz /tmp/crowdsec-splunk-app.tar.gz
28
+
29
+ - name : Retrieve App Inspect Report
30
+ run : |
31
+ TOKEN=$(curl -u '${{ secrets.SPLUNKBASE_USERNAME }}:${{ secrets.SPLUNKBASE_PASSWORD }}' --url 'https://api.splunk.com/2.0/rest/login/splunk' | jq -r .data.token)
32
+ echo "::add-mask::$TOKEN"
33
+ REPORT_HREF=$(curl -X POST \
34
+ -H "Authorization: bearer $TOKEN" \
35
+ -H "Cache-Control: no-cache" \
36
+ -F "app_package=@/tmp/crowdsec-splunk-app.tar.gz" \
37
+ --url "https://appinspect.splunk.com/v1/app/validate"| jq -r .links[1].href)
38
+ REPORT_URL="https://appinspect.splunk.com$REPORT_HREF"
39
+ sleep 10
40
+ curl -X GET \
41
+ -H "Authorization: bearer $TOKEN" \
42
+ --url $REPORT_URL > /tmp/report
43
+
44
+ - name : Upload App Inspect Report
45
+ uses : actions/upload-artifact@v2
46
+ with :
47
+ name : report
48
+ path : /tmp/report
49
+
50
+ - name : Check App Inspect Report Results
51
+ run : |
52
+ if grep -q '"result": "failure"' /tmp/report; then
53
+ echo "::error::App inspect check failed"
54
+ exit 1
55
+ else
56
+ exit 0
57
+ fi
You can’t perform that action at this time.
0 commit comments