Skip to content

Instantly share code, notes, and snippets.

@pzelnip
Last active May 20, 2018 17:03
Show Gist options
  • Save pzelnip/73ec4018d7f81c2dcc6f3d324b335b00 to your computer and use it in GitHub Desktop.
Save pzelnip/73ec4018d7f81c2dcc6f3d324b335b00 to your computer and use it in GitHub Desktop.
Travis Gem in Docker Container
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y ruby ruby-dev make gcc
RUN gem install travis

Installing the Travis Gem in a Docker Container

I don't like Ruby, but to work with Travis I have to get the travis gem installed. As such, rather than installing Ruby & all the dependencies into my main system I set up a Docker image with the travis gem installed.

Build

docker build -t travisgem:latest .

Run

$ docker run --rm -it travisgem:latest /bin/bash

root@635ebf954f6b:/# travis
Shell completion not installed. Would you like to install it now? |y| y
Usage: travis COMMAND ...

Available commands:

        accounts       displays accounts and their subscription status
        branches       displays the most recent build for each branch
        cache          lists or deletes repository caches
        cancel         cancels a job or build
        console        interactive shell
        disable        disables a project
        enable         enables a project
        encrypt        encrypts values for the .travis.yml
        encrypt-file   encrypts a file and adds decryption steps to .travis.yml
        endpoint       displays or changes the API endpoint
        env            show or modify build environment variables
        help           helps you out when in dire need of information
        history        displays a projects build history
        init           generates a .travis.yml and enables the project
        lint           display warnings for a .travis.yml
        login          authenticates against the API and stores the token
        logout         deletes the stored API token
        logs           streams test logs
        monitor        live monitor for what's going on
        open           opens a build or job in the browser
        pubkey         prints out a repository's public key
        raw            makes an (authenticated) API call and prints out the result
        report         generates a report useful for filing issues
        repos          lists repositories the user has certain permissions on
        requests       lists recent requests
        restart        restarts a build or job
        settings       access repository settings
        setup          sets up an addon or deploy target
        show           displays a build or job
        sshkey         checks, updates or deletes an SSH key
        status         checks status of the latest build
        sync           triggers a new sync with GitHub
        token          outputs the secret API token
        version        outputs the client version
        whatsup        lists most recent builds
        whoami         outputs the current user

run `/usr/local/bin/travis help COMMAND` for more infos

You can then login. I tend to use a GH token for this

travis login --github-token <your token>

You may need to add --pro to that depending on your account setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment