Skip to content

Commit

Permalink
add tail
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove committed Oct 29, 2024
1 parent 58aa895 commit 8c33420
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/get-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: true
type: string
default: ''
tail:
description: 'Tail argument'
required: true
type: string
default: '10000'

jobs:
get-logs:
Expand All @@ -28,16 +33,19 @@ jobs:
run: |
echo "DEPLOY_BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
echo "GREP_ARG=${{ github.event.inputs.grep-arg }}" >> $GITHUB_ENV
echo "TAIL_ARG=${{ github.event.inputs.tail }}" >> $GITHUB_ENV
- name: Set up repository_dispatch inputs
if: github.event_name == 'repository_dispatch'
run: |
echo "Received Payload:"
echo "${{ github.event.client_payload.inputs.branch }}"
echo "${{ github.event.client_payload.inputs.grep-arg }}"
echo "${{ github.event.client_payload.inputs.tail }}"
echo "DEPLOY_BRANCH=${{ github.event.client_payload.inputs.branch }}" >> $GITHUB_ENV
echo "GREP_ARG=${{ github.event.client_payload.inputs.grep-arg }}" >> $GITHUB_ENV
echo "TAIL_ARG=${{ github.event.client_payload.inputs.tail }}" >> $GITHUB_ENV
- name: Checkout misc/deploy folder
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion misc/deploy/get_logs_from_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ trap report_fail ERR
echo "${DEPLOY_TARGET_HOST:?}" > /dev/null
echo "${DEPLOY_TARGET_USER:?}" > /dev/null
echo "${GREP_ARG:?}" > /dev/null
echo "${TAIL_ARG:?}" > /dev/null
echo "${DEPLOY_BRANCH:?}" > /dev/null
echo "${DEPLOY_SSH_PRIVATE_KEY:?}" > /dev/null
echo "${DEPLOY_SSH_KNOWN_HOSTS:?}" > /dev/null
Expand Down Expand Up @@ -39,4 +40,4 @@ remote_branch_dir="skymp-server-$DEPLOY_BRANCH"
run_remote test -e "$remote_branch_dir" \
|| (echo "no branch on remote server" && exit 1)

run_remote "bash -c 'docker logs --tail 100 \"$remote_branch_dir\" | grep \"$GREP_ARG\"'"
run_remote "bash -c 'docker logs --tail $TAIL_ARG \"$remote_branch_dir\" | grep \"$GREP_ARG\"'"

0 comments on commit 8c33420

Please sign in to comment.