Skip to content
This repository was archived by the owner on Dec 15, 2018. It is now read-only.

Conversation

@pvdlg
Copy link
Member

@pvdlg pvdlg commented Jan 2, 2018

Every Travis images (no matter the language selected) comes with Node and nvm installed.

Currently if there is no job job explicitly defining a Node version we don't select any build leader and the script is never ran anywhere.

That prevent to do something like this:

language: go

go:
  - 1.6
  - 1.7

os:
  - osx
  - linux

after_success:
  - nvm install 8
  - npm install -g travis-deploy-once
  - travis-deploy-once "echo test"

That config will fails because no job has the node_js param. Even when setting node_js in travis.yml it's not in the config retrieved by the API, as we have the Go version instead.

But it's still possible to run some Javascript as Node and nvm are always installed no matter the language selected.

With this PR the config above will run the script echo script on the the 4th job after the first 3 jobs are completed, without having to set the BUILD_LEADER_ID.

Users can still specify the BUILD_LEADER_ID to force running on a specific job.

@pvdlg pvdlg added the feature label Jan 2, 2018
@pvdlg pvdlg requested a review from gr2m January 2, 2018 06:24
README.md Outdated
- The job configured with the [latest Node version](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) (`node_js: node`).
- The job configured with the [lts Node version](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) (`node_js: lts/*`).
- The job with the highest node version
- The job with the highest job number if none of the jobs specify a node version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reference this pull request for further information? I’d add a (see [#42](https://github.com/semantic-release/travis-deploy-once/pull/42)) for people who are confused about rule

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

'There is no job in this build defining a node version, please set BUILD_LEADER_ID to define the build leader yourself.'
);
return null;
logger.log(`There is no job in this build defining a node version, Elect job ${jobs.length} as build leader.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- , Elect job ${jobs.length}
+ . Electing last job (#${jobs.length}) as build leader

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change suggested, and I ported it on all other occurrences of similar logs

Copy link
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few comments. If you agree you can make the changes and merge it in

@pvdlg pvdlg merged commit 4a37e3d into master Jan 2, 2018
@pvdlg pvdlg deleted the no-node-version branch January 2, 2018 19:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants