-
Notifications
You must be signed in to change notification settings - Fork 1
add yaml #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add yaml #44
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||||||
| name: Test Splunk TA Installs | ||||||||||||
|
|
||||||||||||
| on: | ||||||||||||
| push: | ||||||||||||
| workflow_dispatch: | ||||||||||||
|
|
||||||||||||
| 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 | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| jobs: | ||||||||||||
| test-ta-install: | ||||||||||||
| runs-on: ubuntu-latest | ||||||||||||
| steps: | ||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
|
|
||||||||||||
| - name: Start Splunk (Docker) | ||||||||||||
| run: | | ||||||||||||
| docker run -d --name splunk \ | ||||||||||||
| -e SPLUNK_START_ARGS="--accept-license" \ | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This should also fix the error in the automation execution. |
||||||||||||
| -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" | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||||
|
edro15 marked this conversation as resolved.
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To enable trigger from another workflow and pass the TA name