Sign inSign up

qnimbus/docker-travis-cli

By qnimbus

•Updated over 6 years ago

TravisCI cli utility

Image
0

1.1K

qnimbus/docker-travis-cli repository overview

⁠Docker image for TravisCI

GitHub last commit (branch) Travis (.org) branch Docker Pulls

⁠Why

I needed to use the Travis Client⁠ command line utitlity to generate secure (encrypted) credentials for one of my projects. I did not want to install the client on my system along with the Ruby gem package manager so I decided to create a small docker container instead.

⁠How to use

Refer to the documentation⁠ on how to use the travis client.

⁠Running simple travis commands

Pull the latest container image from Docker:

$ docker pull qnimbus/docker-travis-cli

Optional: Add tag to the image:

$ docker tag qnimbus/docker-travis-cli travis-cli

To run the container:

$ docker run --rm travis-cli version

To run the container and volume mount the pwd:

$ docker run --rm --volume $(pwd):/travis travis-cli lint .travis.yml
$ docker run --rm --volume $(pwd):/travis travis-cli status

⁠Running travis commands that require authentication
  • Ensure that you are in the correct working dir (the github repository you are working on)

  • Start interactive session on the travis-cli container:
    $ docker run -it --rm --volume $(pwd):/travis --entrypoint /bin/sh travis-cli

  • Login to TravisCI:
    note: to generate a github token go to your settings page⁠ with certain permissions⁠

    /travis # travis login --org --github-token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
  • Perform commands as authenticated user:

    /travis # travis whoami
    You are QNimbus (Bas)
    

    For example, to encrypt data:

    /travis # travis encrypt DOCKER_PASSWORD --add global.env
    

⁠Extra

To make using the Travis Client a bit easier from the command line you could create an alias, like so:

$ alias travis-cli="docker run --rm --volume $(pwd):/travis travis-cli"
$ alias travis-clii="docker run -it --rm --volume $(pwd):/travis --entrypoint /bin/sh travis-cli"

This enables you to run:

$ travis-cli status

Or to start the interactive client:

$ travis-clii

/travis # 

To remove the aliases later on:

$ unalias travis-cli travis-clii

⁠TODO

  • Create a shell script that will auto login using environment variables so you can run authenticated commands without having to use an interactive container.

⁠License

MIT⁠

Tag summary

Content type

Image

Digest

Size

42.5 MB

Last updated

over 6 years ago

docker pull qnimbus/docker-travis-cli