6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

snagカレンダーAdvent Calendar 2022

Day 5

GitHub Actions で刺さったので fail するようにした

Posted at

チェックして fail するようにした

謎に止まってしまう → canceled(timeout) 状態になるので,
一定時間ログが増えなくなったら,fail することにした.
とりあえず雑に解決した

run: |
  touch command.log
  run_command | tee command.log &
  prev_count=-1
  for i in 1 2 3 4 5 6 7 8 9 10; do
    jobs
    jobs_count=`jobs | wc -l | awk '{print $1}'`
    echo "jobs count = ${jobs_count}"
    if [ $jobs_count -le 0 ]; then
      echo 'success'
      break
    fi
    wc -l command.log
    count=`wc -l command.log | awk '{print $1}'`
    echo "waiting $i / 10 ... $prev_count -> $count"
    if [ $count = $prev_count ]; then
      echo 'kill process...'
      kill %1
      killed=1
      break
    fi
    prev_count=$count
    sleep 60
  done
  rm -f command.log
  if [ ! -z $killed ]; then
    exit 1
  fi
6
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?