Travis - GradedJestRisk/cicd-training GitHub Wiki
Install
- install ruby
sudo apt-get install ruby-dev
- then follow here
- login:
travis login
- get history:
travis history -d
- get last build:
travis status
Used for secrets:
- defined in repository'settings
- escape all special characters with backslash
Always check .travis.yml file: if invalid, no build will be triggered..
- locally:
travis lint .travis.yml
, you should getHooray, .travis.yml looks valid :)
- with web YAML linter - but you will just have YAML checked, not Travis-specific markups
Overview
- login DockerHub: use environment variables
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
- push image to DockerHub:
docker push <TAG>
Structure
sudo: required services: - <SERVICE_NAME> before_install: - <COMMAND> script: - <COMMAND> deploy: provider: <PROVIDER_NAME> (..) on: branch: master (..)
Sample: Build a docker image, and deploy it to ASW BS
sudo: required services: - docker before_install: - docker build -t <TAG> -f <DOCKER_FILE> . script: - docker run <TAG> deploy: provider: elasticbeanstalk region: "" app: "" env: "" bucket_name: "" bucket_path: "<APPLICATION_NAME>" on: branch: master access_key_id: $AWS_ACCESS_KEY secret_access_key: secure: $AWS_SECRET_KEY
This is done by default on email, can we also use Travis CLI for this or run Travis locally