From b6ea4ecdf0c621f808e9f83e220b824f86852141 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 28 Apr 2020 11:50:03 +0200 Subject: [PATCH] travis: run deploy as final stage The `deploy:` section is executed as part of each successful job. That means the container images and Helm charts are built and pushed many times during testing after a push/merge event. By creating a deploy stage and listing it after the tests, it is guaranteed to run only once after all tests have succeeded. By adding a condition to only run the stage for push events, the images and Helm charts should only get built+pushed after a PR has been merged. See-also: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions Signed-off-by: Niels de Vos --- .travis.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1b654a21..c4240d727 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,12 +51,17 @@ before_script: # only the arm64 fallback repo is unsigned and needs --allow-unauthenticated - sudo apt-get -y --allow-unauthenticated install librados-dev librbd-dev +# Two stages for testing, each stage runs its jobs in parallel, but stages are +# run after each other, unless the last stage fails. +# Only run the deploy stage on push (not pull_request) events. +stages: + - build testing + - e2e testing + - name: deploy + if: type = push + jobs: include: - # two stages for testing, each stage runs its jobs in parallel, but stages - # are run after each other, unless the last stage fails - # - build testing - # - e2e testing - stage: build testing name: static-check-make install: @@ -132,8 +137,6 @@ jobs: - make image-cephcsi || travis_terminate 1; - scripts/travis-helmtest.sh v1.17.0 || travis_terminate 1; -deploy: - - provider: script - on: # yamllint disable-line rule:truthy - all_branches: true - script: ./deploy.sh + - stage: deploy + name: push artifacts to repositories + script: ./deploy.sh