Skip to content

Add remote exec workflow for stateful-generator - #140

Open
kamilchodola wants to merge 19 commits into
mainfrom
stateful-runner-interaction
Open

Add remote exec workflow for stateful-generator#140
kamilchodola wants to merge 19 commits into
mainfrom
stateful-runner-interaction

Conversation

@kamilchodola

Copy link
Copy Markdown
Contributor

Summary

  • Adds a workflow_dispatch workflow to run arbitrary shell commands on the stateful-generator self-hosted runner
  • Useful as an SSH alternative for quick diagnostics and maintenance

Test plan

  • Merge to main so GitHub registers the workflow
  • Trigger via: gh workflow run run-on-stateful-generator.yml -f command="ls /mnt/sda" -f timeout=5

Comment thread .github/workflows/run-on-stateful-generator.yml Fixed
Comment thread .github/workflows/run-on-stateful-generator.yml Fixed
Comment thread .github/workflows/run-on-stateful-generator.yml Fixed
Comment on lines +22 to +62
runs-on: stateful-generator
timeout-minutes: ${{ fromJson(inputs.timeout || '720') }}
steps:
- name: Fire-and-forget jochemnet download
if: ${{ inputs.command == '' }}
run: |
URL="https://snapshots.ethpandaops.io/jochemnet/nethermind/24402727/snapshot.tar.zst"
DEST="/mnt/sda/jochemnet/nethermind"
ARCHIVE="/mnt/sda/jochemnet/snapshot.tar.zst"
LOG="/tmp/jochemnet-download.log"

mkdir -p "$DEST"

nohup bash -c "
until curl -fL -C - --retry 10 --retry-delay 30 --retry-max-time 3600 -o '$ARCHIVE' '$URL'; do
echo 'Download interrupted, retrying in 60s...'
sleep 60
done
echo 'Download complete. Extracting...'
cd '$DEST'
zstd -d --threads=0 '$ARCHIVE' --stdout | tar xf -
rm -f '$ARCHIVE'
echo 'Done.'
" > "$LOG" 2>&1 &

echo "Download launched in background (PID: $!)"
echo "Log: $LOG"
echo "Archive: $ARCHIVE"
sleep 5
echo "Initial progress:"
tail -3 "$LOG"

- name: Execute command
if: ${{ inputs.command != '' }}
run: |
echo "::group::Command"
echo "${{ inputs.command }}"
echo "::endgroup::"
echo "::group::Output"
eval "${{ inputs.command }}"
echo "::endgroup::"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants