How to reproduce a travis-ci build environment for debugging

后端 未结 4 1975
庸人自扰
庸人自扰 2020-12-07 13:29

I am seeing a build failure on travis-ci, which I cannot reproduce on my local machine. Are there instructions somewhere for setting up a VM that is identical to the travis

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 13:53

    For container-based builds, there are now instructions on how to setup a docker image locally.

    Unfortunately, quite a few steps are still manual. Here are the commands you need to get it up and running:

    # change the image according to the language chosen in .travis.yml
    $ docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash
    
    # now that you are in the docker image, switch to the travis user
    sudo su - travis
    
    # Install a recent ruby (default is 1.9.3)
    rvm install 2.3.0
    rvm use 2.3.0
    
    # Install travis-build to generate a .sh out of .travis.yml
    cd builds
    git clone https://github.com/travis-ci/travis-build.git
    cd travis-build
    gem install travis
    travis # to create ~/.travis
    ln -s `pwd` ~/.travis/travis-build
    bundle install
    
    # Create project dir, assuming your project is `me/project` on GitHub
    cd ~/builds
    mkdir me
    cd me
    git clone https://github.com/me/project.git
    cd project
    # change to the branch or commit you want to investigate
    travis compile > ci.sh
    # You most likely will need to edit ci.sh as it ignores matrix and env
    bash ci.sh
    

提交回复
热议问题