【问题标题】:Travis CI Timeout For Specific Jobs特定作业的 Travis CI 超时
【发布时间】:2018-03-28 19:14:14
【问题描述】:

我有一个基于 Travis CI 的构建,并且我有几个工作,其中一个应该将图像推送到远程 docker 注册表。现在有时这个注册表不可用,在这种情况下,我想暂停这个特定的工作,比如 10 分钟后!

这就是我现在所拥有的:

jobs:
  include:
    - stage: test
      script: sbt clean coverage test coverageReport
    - stage: build docker image
      script:
        - if [ $TRAVIS_BRANCH == "master" ]; then
            sbt docker:publishLocal;
            docker login -u $REGISTRY_USER -p $REGISTRY_PASSWORD $DOCKER_REGISTRY_URL;
            docker push $APPLICATION_NAME:$IMAGE_VERSION_DEV;
          fi

我可以从构建日志中看到构建在 10 分钟后超时,这似乎是默认设置。但是如何覆盖并将其设置为 5 分钟?

我在 Travis CI 网站上找不到足够的参考资料。我现在如何在上面的构建 docker 阶段添加超时?

有什么建议吗?

【问题讨论】:

    标签: travis-ci


    【解决方案1】:

    您可以使用travis_wait Bash 函数来实现您想要的,例如

    travis_wait 5 docker push $APPLICATION_NAME:$IMAGE_VERSION_DEV;
    

    https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

    【讨论】:

      【解决方案2】:

      在使用travis_wait 时,您可以探索几个选项/想法:

      1. 导出 travis_wait 函数并在您的 bash 脚本中使用它

        scripts:
         - export -f travis_wait
         - cat./scripts/yours-using-travis_wait.sh | sudo bash -s $SOME_VAR
        
      2. 在 travis-ci 脚本步骤中直接使用travis_wait

        scripts:
         - travis_wait 90 make install
           # OR
         - travis_wait 90 sleep infinity & 
         - cat./scripts/yours.sh | sudo bash -s $SOME_VAR
           # OR in some cases this "quoting" has worked
         - "travis_wait 90 sleep infinity&"
         - curl --funky-stuff-here
        

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-17
        • 1970-01-01
        • 2020-05-10
        • 1970-01-01
        • 2019-10-21
        相关资源
        最近更新 更多