# 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
39
我现在面临同样的问题 . 之前我曾使用CircleCI,您可以通过ssh登录VM,但这不适用于Travis-CI VM .
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- travis/support (LoadError)
我得到了以下调整:(调整标有 # CHANGED . 我正在使用节点环境)
# change the image according to the language chosen in .travis.yml
# Find images at https://quay.io/organization/travisci
docker run -it quay.io/travisci/travis-node-js /bin/bash
# now that you are in the docker image, switch to the travis user
su travis
# Install a recent ruby (default is 1.9.3) to make bundle install work
rvm install 2.3.0
rvm use 2.3.0
# Install travis-build to generate a .sh out of .travis.yml
sudo mkdir builds # CHANGED
cd builds
sudo 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
bundler add travis # CHANGED
sudo mkdir bin # CHANGED
sudo chmod a+w bin/ # CHANGED
bundler binstubs travis # CHANGED
# 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/travis-build/bin/travis compile > ci.sh # CHANGED
# You most likely will need to edit ci.sh as it ignores matrix and env
# In particular I needed to edit --branch=’’ to the branch name
bash ci.sh
4 回答
您可以使用Travis Build这是一个库(这意味着您将它放在
~/.travis/
中)来生成基于shell的构建脚本(travis compile
),然后可以使用SSH将其上载到VM并执行 .以下步骤只是指导,以使您进入正确的轨道(如果有任何遗漏,请告诉我) .
本地
以下是在本地环境中测试它的步骤:
VM
在您执行了
travis compile
后会产生bash脚本的travis compile
之后,您可以使用use vagrant使用提供的Vagrantfile
以及以下步骤将此脚本运行到虚拟化环境中:您可能需要安装更多工具才能对其进行测试 .
这里有一些
git
提示,它可以避免在为Travis CI测试进行试验和错误提交时生成不必要的提交:分叉回购(或使用单独的分支) .
初始提交后,继续添加
--amend
以替换以前的提交:对于基于容器的构建,现在有instructions on how to setup a docker image locally .
不幸的是,相当多的步骤仍然是手动的 . 以下是启动和运行所需的命令:
我现在面临同样的问题 . 之前我曾使用CircleCI,您可以通过ssh登录VM,但这不适用于Travis-CI VM .
通过Travis-Cookbooks设置Travis-ci VM克隆,我能够调试它(到某一点) . 在克隆此存储库之前,您需要先在计算机上安装VirtualBox和Vagrant .
克隆Travis-Cookbooks后,打开文件夹,启动命令提示符|终端并键入
vagrant up
. 一旦Vagrant完成在您的计算机上设置VM(可能需要很长时间),您可以通过运行vagrant ssh
来通过ssh连接到它 .从那里,您需要克隆自己的存储库(或者只是将代码复制到VM)并应用
.travis.yml
文件中的步骤 .Eregon的回答在
travis compile
失败了,错误看起来像:我得到了以下调整:(调整标有 # CHANGED . 我正在使用节点环境)