travis-ci - travis脚本部署超时

标签 travis-ci

我的 .travis.yml 中有以下部署部分

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

问题是 bash script/deploy.sh 可能需要 7 到 10 分钟之间的时间,这意味着这有时会超过 travis 默认情况下的 10 分钟超时。但不用担心 - travis 提供 travis_wait 。这是我更新的 .travis.yml

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

问题是,此操作失败,脚本失败,状态为 127

是否可以在脚本部署中使用travis_wait

最佳答案

我通过将部署命令(npm run deploy)包装在一个简单的脚本中来解决这个问题:

#!/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

关于travis-ci - travis脚本部署超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39288834/

相关文章:

docker - 用于travis构建的Docker缓存

travis-ci - 特拉维斯CI : Run after_success on a specific branch

java - Maven 无法拉取对 travis-ci : Connection timed out 的依赖

javascript - Travis CI 是否支持 PhoneGap 应用程序?

c++ - 在 Travis 服务器上使用 Buck 构建

python - Wand 无法打开现有文件

deployment - Travis CI 开始构建新标签

sbt - 添加凭据以允许 Travis-CI 使用私有(private) Nexus 存储库

bash - 特拉维斯 CI : How do I escape my password for `travis encrypt` to work?

linux - 在 Travis-CI 中采购 .bashrc 不工作