diff --git a/.travis.yml b/.travis.yml index 3f93965..6fb03a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,10 @@ -language: go +sudo: required services: - docker +language: go + go: - 1.12.x @@ -21,16 +23,22 @@ install: jobs: include: - - stage: unit-test if: type IN (push, pull_request) script: - make test - bash <(curl -s https://codecov.io/bash) - - stage: publish-image - if: type = push + - stage: publish-latest-image + if: branch = master AND type = push script: - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - make docker-build - - make docker-push \ No newline at end of file + - make docker-push + + - stage: publish-tagged-image + if: tag IS present + script: + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + - TAG=${TRAVIS_TAG} make docker-build + - TAG=${TRAVIS_TAG} make docker-push \ No newline at end of file diff --git a/Makefile b/Makefile index c7f6d89..0a79269 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ # Image URL to use all building/pushing image targets -IMG ?= orkaproj/kube-forensics-controller:latest -WORKERIMG ?= orkaproj/kube-forensics-worker:latest +TAG ?= latest +IMG ?= orkaproj/kube-forensics-controller:${TAG} +WORKERIMG ?= orkaproj/kube-forensics-worker:${TAG} # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd:trivialVersions=true"