https://github.com/lirantal/docker-travis-cli
Travis CLI in a docker container (encrypt, lint, env, monitor)
https://github.com/lirantal/docker-travis-cli
build docker travis travis-ci travis-cli
Last synced: about 1 month ago
JSON representation
Travis CLI in a docker container (encrypt, lint, env, monitor)
- Host: GitHub
- URL: https://github.com/lirantal/docker-travis-cli
- Owner: lirantal
- License: apache-2.0
- Created: 2018-11-17T16:30:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-13T03:41:49.000Z (about 2 years ago)
- Last Synced: 2025-02-25T23:34:23.233Z (about 2 months ago)
- Topics: build, docker, travis, travis-ci, travis-cli
- Language: Dockerfile
- Size: 18.6 KB
- Stars: 12
- Watchers: 4
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[]( https://g.codefresh.io/pipelines/docker-travis-cli/builds?repoOwner=lirantal&repoName=docker-travis-cli&serviceName=lirantal%2Fdocker-travis-cli&filter=trigger:build~Build;branch:master;pipeline:5bf043d341859180ee3f5e4d~docker-travis-cli)
[](https://microbadger.com/images/lirantal/travis-cli "Get your own version badge on microbadger.com")
[](https://microbadger.com/images/lirantal/travis-cli "Get your own image badge on microbadger.com")# About
One may often need to invoke the Travis CLI such as for encrypting environment variables for Travis CI, yet that requires to use
travis's ruby binary, and hence requires a ruby runtime.This small docker image exposes the travis CLI so that it is easily accessible and isolated
inside of a docker container, leaving you out of the need to set it up yourself.# Usage
The docker image already has ruby and the `travis` gem installed so it can execute any
commands for the Travis CLI.The image's entrypoint is set to the `travis` executable so any command line arguments
appended to `docker run` will be added to that, providing easy access to users.## Logging in
```
docker run --rm -v ${HOME}/.travis:/root/.travis -it lirantal/travis-cli login
```## Encrypting environment variables
When encrypting something, the travis cli needs a way to know what travis repository
you are encrypting for so it can use the correct private key. This is either done by
being in the project's git repository which has the details, or providing a `-r /`
argument that specifies this.This docker image uses the latter as a more verbose and flexible option to encrypt
environment variables.Example:
```
docker run --rm -v ${HOME}/.travis:/root/.travis lirantal/travis-cli encrypt ENV_VARIABLE_NAME="GH_TOKEN_GOES_HERE" -r lirantal/dockly
```Or, to allow it to automatically detect the repository from the current directory:
```
docker run --rm -v ${HOME}/.travis:/root/.travis lirantal/travis-cli -v ${PWD}:${PWD} --workdir ${PWD} \
encrypt ENV_VARIABLE_NAME="GH_TOKEN_GOES_HERE" -r lirantal/dockly
```Documentation Resources:
* [travis keys encryption](https://docs.travis-ci.com/user/encryption-keys/)## Linting a .travis.yml file
Add the lint command option and the path to the `.travis.yml`:
```
docker run --rm lirantal/travis-cli lint .travis.yml
```# Contributing
You're welcome to suggest any changes and/or improvements by updating the Dockerfile or any other
idea you may have.Building the image from the Dockerfile and then you may execute it locally:
```
docker build --tag lirantal/travis-cli .
```# Author
Liran Tal