One of the original hosted CI/CD systems.
Reasonable UI, but...
travis-ci.org was free for open source, but has been retired.
travis-ci.com remains as a paid offering.
This has caused Travis CI to go from once leading open source to now legacy CI/CD.
Superceded by newer more free CI/CD systems like GitHub Actions now which is unlimited free for all public projects.
Copy to root of GitHub repo and edit:
wget -nc -O https://raw.githubusercontent.com/HariSekhon/Templates/master/.travis.yml
Paste .travis.yml
config in this online validator to see parsing and job matrix:
https://config.travis-ci.com/explore
- CCMenu - Mac OSX menu watcher
- BuildNotify - for Linux
Here is the URL for the above desktop notifiation tools
<https://api.travis-ci.org/repos/<owner>/<repo>/cc.xml>
Returns empty json {}
if it doesn't find the repo
Config I used for CCMenu on Mac for several years to monitor my GitHub repos:
mkdir -p -v ~/Library/Containers/net.sourceforge.cruisecontrol.CCMenu/Data/Library/Preferences/
wget -nc -O ~/Library/Containers/net.sourceforge.cruisecontrol.CCMenu/Data/Library/Preferences/net.sourceforge.cruisecontrol.CCMenu.plist \
https://raw.githubusercontent.com/HariSekhon/DevOps-Bash-tools/master/Library/Containers/net.sourceforge.cruisecontrol.CCMenu/Data/Library/Preferences/net.sourceforge.cruisecontrol.CCMenu.plist
Follow the install doc or paste this to run an automated install script which auto-detects and handles Mac or Linux:
git clone https://github.com/HariSekhon/DevOps-Bash-tools
bash-tools/install/install_travis.sh
OR manually:
gem install travis --no-rdoc --no-ri
travis login
travis token
Linting:
travis lint # .travis.yml
Switches of notes:
Switch | Description |
---|---|
-q | quiet mode |
-x | exit 1 if lint fails |
travis lint -x .travis.yml
travis endpoint --org --set-default
travis login
Set up this token in github:
travis login --github-token
Set up token in .netrc
:
travis login --auto
travis monitor -r <repo1> -r <repo2>
Switch | Description |
---|---|
-n | all my repos |
-m | notify desktop |
Left hand pan recent repo statuses:
travis whatsup
travis history
Create .travis.yml
template for given lang:
travis init <lang>
travis init java
Restart Travis CI build from within a Git repo checkout:
travis restart
Make sure it is case sensitive otherwise you'll get output:
repository not known to https://api.travis-ci.org/: harisekhon/nagios-plugins
in local checkout's .git/config
:
[travis]
slug = HariSekhon/nagios-plugins
Travis hosts containers on Quay.io
- port 22
- login:
- user: travis
- password: travis
Supported for the following languages:
- android
- erlang
- go
- haskell
- jvm
- node-js
- perl
- php
- python
- ruby
Hangs so don't run in foreground:
docker run -d -p 2222; 22 --name travis-${TRAVIS_LANGUAGE} quay.io/travisci/travis-${TRAVIS_LANGUAGE}
ssh -p 2222 travis@$HOST # pw travis
or
docker exec travis-${TRAVIS_LANGUAGE}
su - travis
Launch a debug VM
Username + Password for GitHub:
travis login --org --auto
travis token --org
This should be the last bit of the url, eg.
<https://travis-ci.org/HariSekhon/nagios-plugin-kafka/jobs/144678953>
means
JOB_ID=144678953
export JOB_ID
export TRAVIS_TOKEN=$(travis token --org | awk '{print $2}')
echo "Travis token is $TRAVIS_TOKEN"
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $TRAVIS_TOKEN" "https://api.travis-ci.org/job/$JOB_ID/debug"
travis_debug()
in .bash.d/travis_ci.sh
In Web UI log, see lines
Setting up debug tools.
Preparing debug sessions.
Use the following SSH command to access the interactive debugging environment:
ssh <login_token>@ny2.tmate.io
SSH to the given address on the last line.
From DevOps-Python-tools repo:
- travis_debug_session.py
- automates creating a Travis CI interactive debug build session via the Travis API
- tracks the creation of the debug build, parses the log and drops you in to the unique SSH shell login as soon as it's available
- travis_last_log.py
- automates fetching the last running / completed / failed build log from Travis CI via the Travis API
Ported from private Knowledge Base page 2014+