-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (50 loc) · 1.83 KB
/
appinspect.yaml
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
name: App inspect tests
on:
push:
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9.16'
- name: Install Splunk Packaging Toolkit
run: |
curl https://download.splunk.com/misc/packaging-toolkit/splunk-packaging-toolkit-1.0.1.tar.gz -o /tmp/spl.tar.gz
pip install /tmp/spl.tar.gz
- name: Create Splunk App Package
run: |
rm -rf .git .github .gitignore
slim package .
cp crowdsec-splunk-app-*.tar.gz /tmp/crowdsec-splunk-app.tar.gz
- name: Retrieve App Inspect Report
run: |
TOKEN=$(curl -u '${{ secrets.SPLUNKBASE_USERNAME }}:${{ secrets.SPLUNKBASE_PASSWORD }}' --url 'https://api.splunk.com/2.0/rest/login/splunk' | jq -r .data.token)
echo "::add-mask::$TOKEN"
REPORT_HREF=$(curl -X POST \
-H "Authorization: bearer $TOKEN" \
-H "Cache-Control: no-cache" \
-F "app_package=@/tmp/crowdsec-splunk-app.tar.gz" \
--url "https://appinspect.splunk.com/v1/app/validate"| jq -r .links[1].href)
REPORT_URL="https://appinspect.splunk.com$REPORT_HREF"
sleep 60
curl -X GET \
-H "Authorization: bearer $TOKEN" \
--url $REPORT_URL > /tmp/report
- name: Upload App Inspect Report
uses: actions/upload-artifact@v2
with:
name: report
path: /tmp/report
- name: Check App Inspect Report Results
run: |
if grep -q '"result": "failure"' /tmp/report; then
echo "::error::App inspect check failed"
exit 1
else
exit 0
fi