Search code examples
travis-citravis-ci-cli

Can you install/use Travis Cli inside travis script?


As a part of my my customized travis build I would like to use Travis command-line client inside after_success script. I need that to trigger some operations on other travis jobs (other repositories) after each successfull build in this particular repo. So two questions:

  • Is it possible at all?
  • If so is there any smart or quick way to do that?

As far as I know Travis Cli has several ruby dependencies that may not be available by default. But perhaps it is by default installed on travis VMs.


Solution

  • Yes, this is completely possible. However, this would only work for language: ruby jobs.

    For your specific case, you can do:

    after_success:
      # install travis cli
      - gem install --no-document travis
      # setup travis shell autocomplete
      - echo "y" | travis --version
      # do travis cli stuff
      - travis do stuff
    

    If you have a project using another language, then this becomes much more complicated.