Macs Dickinson
Macs Dickinson

Reputation: 987

travis script deployment timeout

I have the following deploy section in my .travis.yml

deploy:
  provider: script
  script: bash scripts/deploy.sh
  skip_cleanup: true
  on:
    all_branches: true

The problem is that bash scripts/deploy.sh can take anywhere between 7 and 10 minutes meaning that this occasionally goes over the 10 minute timeout that travis has by default. But not to worry - travis offers travis_wait. Here is my updated .travis.yml.

deploy:
  provider: script
  script: travis_wait 30 bash scripts/deploy.sh
  skip_cleanup: true
  on:
    all_branches: true

Problem is, this fails with Script failed with status 127.

Is it possible to use travis_wait within script deployment?

Upvotes: 2

Views: 803

Answers (1)

Brad Pitcher
Brad Pitcher

Reputation: 1785

I worked around this by wrapping my deploy command (npm run deploy) in a simple script:

#!/bin/bash

npm run deploy &

# Output to the screen every 9 minutes to prevent a travis timeout
export PID=$!
while [[ `ps -p $PID | tail -n +2` ]]; do
  echo 'Deploying'
  sleep 540
done

Upvotes: 2

Related Questions