Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**DO NOT MERGE** Attempt to trigger a Travis CI npm ci install error #13613

Closed
wants to merge 3 commits into from

Conversation

ntwb
Copy link
Member

@ntwb ntwb commented Jan 31, 2019

Description

DO NOT MERGE

Ref #13462 (comment)

...it begs the question then: Why isn't it currently failing, if npm ci is meant to exit with an error when a package-lock.json and when the Travis build is meant to error and stop immediately when a script in install errors?

This PR is attempting to trigger a Travis CI build job to terminate with an error due to package.json has been updated but *not the package-lock.json file.

Currently npm ci is in the install section of .travis.yml: https://github.com/WordPress/gutenberg/blob/master/.travis.yml#L34-L35

Per the docs at https://docs.travis-ci.com/user/job-lifecycle#breaking-the-build

If before_install, install or before_script returns a non-zero exit code, the build is errored and stops immediately.
If script returns a non-zero exit code, the build is failed, but continues to run before being marked as failed.

Therefore the build should throw errored and terminate immediately upon error.

How has this been tested?

See above, this is a test PR for #13462

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ntwb ntwb added [Status] In Progress Tracking issues with work in progress [Type] Build Tooling Issues or PRs related to build tooling [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. labels Jan 31, 2019
@ntwb ntwb self-assigned this Jan 31, 2019
@ntwb
Copy link
Member Author

ntwb commented Jan 31, 2019

Confirming that the .1 job errored with exit code 1 after 59 seconds:

$ nvm install --latest-npm
Found '/home/travis/build/WordPress/gutenberg/.nvmrc' with version <lts/*>
Downloading and installing node v10.15.1...
Local cache found: $NVM_DIR/.cache/bin/node-v10.15.1-linux-x64/node-v10.15.1-linux-x64.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v10.15.1-linux-x64/node-v10.15.1-linux-x64.tar.xz
Now using node v10.15.1 (npm v6.4.1)
Attempting to upgrade to the latest working version of npm...
0: command not found
0: command not found
* Installing latest `npm`; if this does not work on your node version, please report a bug!
/home/travis/.nvm/versions/node/v10.15.1/bin/npm -> /home/travis/.nvm/versions/node/v10.15.1/lib/node_modules/npm/bin/npm-cli.js
/home/travis/.nvm/versions/node/v10.15.1/bin/npx -> /home/travis/.nvm/versions/node/v10.15.1/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.7.0
added 52 packages from 7 contributors, removed 13 packages and updated 41 packages in 6.522s
* npm upgraded to: v6.7.0
0.66s$ npm ci
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR! 
npm ERR! 
npm ERR! Invalid: lock file's lerna@3.4.3 does not satisfy lerna@3.10.7
npm ERR! 
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2019-01-31T10_59_39_229Z-debug.log
The command "npm ci" failed and exited with 1 during .

Your build has been stopped.

The build continued though, even though the last line states Your build has been stopped., this could be due to that fast_finish: true is required to terminate the build
screen shot 2019-01-31 at 10 00 21 pm

@ntwb
Copy link
Member Author

ntwb commented Jan 31, 2019

The docs state: https://docs.travis-ci.com/user/build-matrix/#sts=Fast%20Finishing%20#

Fast Finishing #

If some rows in the build matrix are allowed to fail, the build won’t be marked as finished until they have completed.

To mark the build as finished as soon as possible, add fast_finish: true to the matrix section of your .travis.yml like this:

matrix:
  fast_finish: true

As we currently don't use matrix I suspect this might prevent us from using fast_finish

I'll try a commit switching from jobs: to matrix: at https://github.com/WordPress/gutenberg/blob/master/.travis.yml#L28

@ntwb
Copy link
Member Author

ntwb commented Jan 31, 2019

Aside: Switching from jobs to matrix did not change the job matrix, the same 7 jobs were created.

Adding fast_finish: true had no effect, the .1 job errored in 1 min 1 sec but the remaining 6 jobs continued to run until completetion. The Slack notification is also not sent until the entire CI build jobs has completed.

I'm not sure why fast_finish is not terminating the build, @BanzaiMan, any thoughts on why this might not be working as expected?

@ntwb
Copy link
Member Author

ntwb commented Jan 31, 2019

Closing this PR, it has served its testing purpose for #13462 though I still do not know why fast_fisnish: true is not working as I expected it to here.

@ntwb ntwb closed this Jan 31, 2019
@ntwb ntwb deleted the try/trigger-npm-ci-install-error branch January 31, 2019 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant