Travis CI

  1. $ cat .travis.yml
  2. services:
  3. - docker
  4. env:
  5. global:
  6. - COMMIT=${TRAVIS_COMMIT::8}
  7. before_install:
  8. - docker build -t trivy-ci-test:${COMMIT} .
  9. - export VERSION=$(curl --silent "https://api.github.com/repos/aquasecurity/trivy/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
  10. - wget https://github.com/aquasecurity/trivy/releases/download/v${VERSION}/trivy_${VERSION}_Linux-64bit.tar.gz
  11. - tar zxvf trivy_${VERSION}_Linux-64bit.tar.gz
  12. script:
  13. - ./trivy --exit-code 0 --severity HIGH --no-progress trivy-ci-test:${COMMIT}
  14. - ./trivy --exit-code 1 --severity CRITICAL --no-progress trivy-ci-test:${COMMIT}
  15. cache:
  16. directories:
  17. - $HOME/.cache/trivy

Example Repository