Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/reusable-test-ta-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test Splunk TA Installs

on:
push:
workflow_dispatch:
Comment thread
shalper2 marked this conversation as resolved.
Outdated

env:
SPLUNK_PASSWORD: password
SPLUNK_USER: admin
# Set this to your actual TA folder/app name (must match the folder name under etc/apps)
TA_NAME: TA-your_addon_name
Comment thread
shalper2 marked this conversation as resolved.
Outdated

jobs:
test-ta-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Comment thread
shalper2 marked this conversation as resolved.
Outdated

- name: Start Splunk (Docker)
run: |
docker run -d --name splunk \
-e SPLUNK_START_ARGS="--accept-license" \
Comment thread
shalper2 marked this conversation as resolved.
Outdated
-e SPLUNK_PASSWORD="${SPLUNK_PASSWORD}" \
-p 8089:8089 -p 8000:8000 \
splunk/splunk:latest

- name: Wait for Splunk API
run: |
for i in {1..60}; do
if curl -sk https://localhost:8089/services/server/info >/dev/null; then
echo "Splunk is up"
exit 0
fi
sleep 5
done
docker logs splunk
exit 1

- name: Install TA into Splunk and restart
run: |
docker exec splunk mkdir -p /opt/splunk/etc/apps/"$TA_NAME"
docker cp . splunk:/opt/splunk/etc/apps/"$TA_NAME"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is going to work. Need to build the TA from package first to be able to copy it in the container. 🤔

docker exec splunk bash -lc "chown -R splunk:splunk /opt/splunk/etc/apps/$TA_NAME"
docker exec splunk bash -lc "/opt/splunk/bin/splunk restart --accept-license --answer-yes --no-prompt"

- name: Verify app is registered
run: |
docker exec splunk bash -lc \
"curl -sk -u ${SPLUNK_USER}:${SPLUNK_PASSWORD} \
https://localhost:8089/services/apps/local?count=0 \
| tr '\n' ' ' \
| grep -q \"<title>${TA_NAME}</title>\""

- name: Dump logs on failure
if: failure()
run: docker logs splunk
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Loading