autocompleteinstallationtravis-ciunattended-processing

Travis unattended install with no first-run prompts (completions)


I want to install TravisCI CLI unattended.

With a ruby 2.1 runtime, as recommended by linked readme, the travis cli base tools can be installed with gem:

gem install travis -v 1.8.0 --no-rdoc --no-ri

However, upon first run travis will prompt the user to install completions.

I desire no first-run behavior of deployed installed software.

My case may be simplified by having only one target user: ubuntu.


Solution

  • Specifically for travis 1.8.0, since that version is locked in your gem install example; the install_completions method can be called directly:

    # This step operates on the current users ~/.travis data,
    # as the target user eg: "$su ubuntu"
    
    ruby \
      -r /var/lib/gems/2.1.0/gems/travis-1.8.0/lib/travis/tools/completion.rb \
      -e "Travis::Tools::Completion.install_completion"
    

    The /var/lib/gems/2.1.0 prefix can be determined with gem env; INSTALLATION DIRECTORY key.

    I browsed the 'gems' subfolder to locate the Travis files specifically.

    Note: If there a multiple users, the generated ~/.travis directory should be safe to copy to other users.


    Alternatively, if you want the prompt silenced/squelched without completions, there is a simple .yaml file: ~/.travis/config.yml to which the follow keys can be added:

    ---
    checked_completion: true
    completion_version: 1.8.0