-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sbs2001/report-fix
Cloud check fail fix
- Loading branch information
Showing
34 changed files
with
835 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 10 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.