Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Travis deploying multiple times when I'm running my tests on multiple Node versions?

Tags:

travis-ci

I test on three different Node versions (mainly to alert me to any compatibility issues that might arise if I was forced to switch to another version in production):

sudo: false
language: node_js
node_js:
  - iojs
  - '0.12'
  - '0.10'
deploy:
  skip_cleanup: true
  provider: script
  script: ./deploy.sh
  on:
    branch: master
matrix:
  allow_failures:
    - node_js: iojs

But that means my ./deploy.sh script is run three times, from three different containers! I obviously only want one of the successful builds to be deployed. The other builds are just for catching Node issues.

Is there a way to configure it so it only runs my deploy script after one of the jobs? Maybe another setting under on:?

The docs for script provider don't cover this.

like image 863
callum Avatar asked Mar 14 '23 15:03

callum


1 Answers

What about setting a node: '0.10' option under on:? Like so:

deploy:
  skip_cleanup: true
  provider: script
  script: ./deploy.sh
  on:
    branch: master
    node: '0.10'

This should run the deploy job only on the node: '0.10' target.

From the Travis Deployment official docs:

jdk, node, perl, php, python, ruby, scala, go: For language runtimes that support multiple versions, you can limit the deployment to happen only on the job that matches the desired version.

like image 91
Nicolás Fantone Avatar answered Apr 30 '23 05:04

Nicolás Fantone