Skip to content

Major refactor

Major refactor #17

Workflow file for this run

name: tests
on:
pull_request:
branches:
- master
- develop
jobs:
slim-validate:
name: SLIM Validation
runs-on: ubuntu-latest
outputs:
app_name: ${{ steps.appinfo.outputs.app_name }}
app_id: ${{ steps.appinfo.outputs.app_id }}
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Checkout code
uses: actions/checkout@v3
- name: Fetch and set app info
id: appinfo
run: |
APP_ID=$(cat packages/splunk-*/app.manifest | jq -r '.info.id.name')
echo "app_id=${APP_ID}" >> $GITHUB_OUTPUT
APP_NAME=$(echo "$APP_ID" | tr _ - )
echo "app_name=${APP_NAME}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install splunk-packaging-toolkit
- name: Slim Validate
run: |
cp README.md packages/${{ steps.appinfo.outputs.app_id }}
slim validate packages/${{ steps.appinfo.outputs.app_id }}
splunk-test:
name: Deploy and test the Viz
runs-on: ubuntu-latest
needs: slim-validate
strategy:
matrix:
version: [9.1]
# version: [9.1, 9.0, 8.2.0]
services:
splunk:
image: splunk/splunk:${{ matrix.version }}
env:
SPLUNK_START_ARGS: --answer-yes --no-prompt --accept-license
SPLUNK_PASSWORD: password
SPLUNK_APPS_URL: https://splunkbase.splunk.com/app/2890/release/5.4.1/download
# ,https://splunkbase.splunk.com/app/2882/release/4.2.0/download
SPLUNKBASE_USERNAME: ${{ secrets.SPLUNKBASE_USERNAME }}
SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}
DEBUG: true
options: >-
--health-interval 30s
--health-timeout 5s
--health-retries 5
--name splunk
ports:
- 8000:8000
- 8089:8089
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Copy app to service container and validate
run: |
docker cp packages/${{ needs.slim-validate.outputs.app_id }} ${{ job.services.splunk.id }}:/opt/splunk/etc/apps/${{ needs.slim-validate.outputs.app_id }}
docker exec -i ${{ job.services.splunk.id }} ls -a /opt/splunk/etc/apps
docker exec -i ${{ job.services.splunk.id }} ls -a /opt/splunk/etc/apps/${{ needs.slim-validate.outputs.app_id }}
- name: Disable SPL safeguards for all commands
run: |
cat >> web.conf << 'END'
[settings]
enable_risky_command_check = 0
enable_risky_command_check_dashboard = 0
END
docker cp web.conf ${{ job.services.splunk.id }}:/opt/splunk/etc/system/local/web.conf
echo "Validating 'web.conf' file creation"
docker exec -i ${{ job.services.splunk.id }} ls -a /opt/splunk/etc/system/local/
- name: Restart instance
run: |
curl -k -u admin:password https://splunk:8089/services/server/control/restart -X POST
sleep 30
- name: Configure MLTK permissions
run: |
curl --retry-delay 5 --retry 5 -f -k -u admin:password https://splunk:8089/services/apps/local/Splunk_ML_Toolkit/acl -d sharing=global -d owner=nobody -X POST
echo "Check MLTK permissions"
curl -k -u admin:password https://splunk:8089/services/apps/local/Splunk_ML_Toolkit/acl?output_mode=json | jq -r '.entry | .[].acl.sharing'
- name: Print App Configuration
run: |
curl -k -u admin:password https://splunk:8089/services/apps/local/${{ needs.slim-validate.outputs.app_id }}
- name: Run Tests
run: |
make test
- name: Upload Test Results
uses: actions/upload-artifact@v3
with:
name: splunk${{ matrix.versions }}-results
path: |
test/cypress/videos
- name: JUnit Report
uses: dorny/test-reporter@v1
# if: always()
with:
name: Cypress Tests
path: cypress/results/results.xml
reporter: java-junit
fail-on-error: true