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

Stack trace on no changes when running publish #887

Closed
SimenB opened this issue Jun 19, 2017 · 4 comments
Closed

Stack trace on no changes when running publish #887

SimenB opened this issue Jun 19, 2017 · 4 comments

Comments

@SimenB
Copy link
Contributor

SimenB commented Jun 19, 2017

Expected Behavior

I expect to just get a nice message and exit 1 on no changes when running publish

Current Behavior

$ yarn lerna publish
yarn lerna v0.24.6
$ "/Users/simbekkh/repos/podium/node_modules/.bin/lerna" publish
lerna info version 2.0.0-rc.5
lerna info versioning independent
lerna info Checking for updated packages...
lerna info Comparing with tag @finn-no/podium-client@1.0.0-alpha.11
lerna info No updated packages to publish.
lerna ERR! execute Error: On branch master
lerna ERR! execute Your branch is up-to-date with 'origin/master'.
lerna ERR! execute nothing to commit, working tree clean
lerna ERR! execute
lerna ERR! execute     at Function.module.exports.sync (/Users/simbekkh/repos/podium/node_modules/execa/index.js:277:26)
lerna ERR! execute     at Function.execSync (/Users/simbekkh/repos/podium/node_modules/lerna/lib/ChildProcessUtilities.js:59:30)
lerna ERR! execute     at Function.commit (/Users/simbekkh/repos/podium/node_modules/lerna/lib/GitUtilities.js:84:39)
lerna ERR! execute     at PublishCommand.gitCommitAndTagVersionForUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:578:30)
lerna ERR! execute     at PublishCommand.commitAndTagUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:560:26)
lerna ERR! execute     at PublishCommand.execute (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:246:16)
lerna ERR! execute     at PublishCommand._attempt (/Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:265:21)
lerna ERR! execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:252:15
lerna ERR! execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:274:13
lerna ERR! execute     at PublishCommand.initialize (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:205:9)
lerna ERR! execute  callback with error
lerna ERR! execute  Error: On branch master
lerna ERR! execute Your branch is up-to-date with 'origin/master'.
lerna ERR! execute nothing to commit, working tree clean
lerna ERR! execute
lerna ERR! execute     at Function.module.exports.sync (/Users/simbekkh/repos/podium/node_modules/execa/index.js:277:26)
lerna ERR! execute     at Function.execSync (/Users/simbekkh/repos/podium/node_modules/lerna/lib/ChildProcessUtilities.js:59:30)
lerna ERR! execute     at Function.commit (/Users/simbekkh/repos/podium/node_modules/lerna/lib/GitUtilities.js:84:39)
lerna ERR! execute     at PublishCommand.gitCommitAndTagVersionForUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:578:30)
lerna ERR! execute     at PublishCommand.commitAndTagUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:560:26)
lerna ERR! execute     at PublishCommand.execute (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:246:16)
lerna ERR! execute     at PublishCommand._attempt (/Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:265:21)
lerna ERR! execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:252:15
lerna ERR! execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:274:13
lerna ERR! execute     at PublishCommand.initialize (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:205:9)
error Command failed with exit code 1.

Possible Solution

Drop the stack trace. Stopping at lerna info No updated packages to publish. should be enough.

Steps to Reproduce (for bugs)

  1. Have no changes in a lerna repo
  2. Run lerna publish
lerna.json

{
  "lerna": "2.0.0-rc.5",
  "version": "independent",
  "npmClient": "yarn",
  "registry": "http://npm.finntech.no"
}

lerna-debug.log

0 silly input [ 'publish' ]
1 silly flags { _: [ 'publish' ], sort: true, concurrency: 4 }
2 verbose rootPath /Users/simbekkh/repos/podium
3 info version 2.0.0-rc.5
4 info versioning independent
5 silly isInitialized
6 silly isInitialized true
7 silly existsSync /Users/simbekkh/repos/podium/VERSION
8 silly initialize attempt
9 silly getUpdates
10 info Checking for updated packages...
11 silly hasTags
12 verbose hasTags true
13 silly getLastTag
14 verbose getLastTag @finn-no/podium-client@1.0.0-alpha.11
15 info Comparing with tag @finn-no/podium-client@1.0.0-alpha.11
16 silly getLastTaggedCommitInBranch
17 silly getLastTag
18 verbose getLastTag @finn-no/podium-client@1.0.0-alpha.11
19 verbose getLastTaggedCommitInBranch c8e529a1ffc10d1c9585d94e83101495ec5daf28
20 silly describeTag c8e529a1ffc10d1c9585d94e83101495ec5daf28
21 silly describeTag @finn-no/podium-client@1.0.0-alpha.11
22 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/finn-podium-client
23 silly diff
24 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/finn-proxy-services
25 silly diff
26 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-client
27 silly diff
28 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-dev-server
29 silly diff
30 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-express-resource-proxy
31 silly diff
32 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-host-middleware
33 silly diff
34 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-marko-taglib
35 silly diff
36 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podium-schemas
37 silly diff
38 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podlet-global-search
39 silly diff
40 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podlet-market-icons
41 silly diff
42 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podlet-recommendations
43 silly diff
44 silly diffSinceIn @finn-no/podium-client@1.0.0-alpha.11 /Users/simbekkh/repos/podium/packages/podlet-user-searches
45 silly diff
46 silly collectDependents
47 silly collectUpdates
48 info No updated packages to publish.
49 silly initialize success
50 silly execute attempt
51 silly isDetachedHead
52 silly getCurrentBranch
53 verbose getCurrentBranch master
54 verbose isDetachedHead false
55 silly commit Publish
56 verbose commit [ 'commit',
56 verbose commit   '-F',
56 verbose commit   '/private/var/folders/89/vbf7hhns3m9g138cgy1hzlrx17ddry/T/ea21e510-e791-4caa-8cf1-c79085b8d691/lerna-commit.txt' ]
57 error execute Error: On branch master
57 error execute Your branch is up-to-date with 'origin/master'.
57 error execute nothing to commit, working tree clean
57 error execute
57 error execute     at Function.module.exports.sync (/Users/simbekkh/repos/podium/node_modules/execa/index.js:277:26)
57 error execute     at Function.execSync (/Users/simbekkh/repos/podium/node_modules/lerna/lib/ChildProcessUtilities.js:59:30)
57 error execute     at Function.commit (/Users/simbekkh/repos/podium/node_modules/lerna/lib/GitUtilities.js:84:39)
57 error execute     at PublishCommand.gitCommitAndTagVersionForUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:578:30)
57 error execute     at PublishCommand.commitAndTagUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:560:26)
57 error execute     at PublishCommand.execute (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:246:16)
57 error execute     at PublishCommand._attempt (/Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:265:21)
57 error execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:252:15
57 error execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:274:13
57 error execute     at PublishCommand.initialize (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:205:9)
57 error execute  callback with error
57 error execute  Error: On branch master
57 error execute Your branch is up-to-date with 'origin/master'.
57 error execute nothing to commit, working tree clean
57 error execute
57 error execute     at Function.module.exports.sync (/Users/simbekkh/repos/podium/node_modules/execa/index.js:277:26)
57 error execute     at Function.execSync (/Users/simbekkh/repos/podium/node_modules/lerna/lib/ChildProcessUtilities.js:59:30)
57 error execute     at Function.commit (/Users/simbekkh/repos/podium/node_modules/lerna/lib/GitUtilities.js:84:39)
57 error execute     at PublishCommand.gitCommitAndTagVersionForUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:578:30)
57 error execute     at PublishCommand.commitAndTagUpdates (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:560:26)
57 error execute     at PublishCommand.execute (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:246:16)
57 error execute     at PublishCommand._attempt (/Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:265:21)
57 error execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:252:15
57 error execute     at /Users/simbekkh/repos/podium/node_modules/lerna/lib/Command.js:274:13
57 error execute     at PublishCommand.initialize (/Users/simbekkh/repos/podium/node_modules/lerna/lib/commands/PublishCommand.js:205:9)

Context

N/A

Your Environment

Executable Version
lerna --version 2.0.0-rc.5
npm --version 5.0.3
yarn --version 0.24.6
node --version 6.11.0
OS Version
macOS Sierra 12.12.4
@evocateur
Copy link
Member

As noted in #807, turns out https://github.com/lerna/lerna/blob/master/src/commands/PublishCommand.js#L128 should actually be callback(null, false) so we don't attempt to proceed with the execute() phase (where the erroneous git commit is being attempted on an unchanged tree).

This also means we'll have to modify the semantics of the writeLogFile() conditional to avoid writing out logs if a non-error wants to exit non-zero. I should think if (err) { would be more appropriate, as exiting early should never actually be caused by a legit error passed to the _attempt() callback.

@dan3721
Copy link

dan3721 commented Aug 4, 2017

Same here:

? Are you sure you want to publish the above changes? Yes lerna ERR! execute Error: On branch master lerna ERR! execute Your branch is up-to-date with 'origin/master'. lerna ERR! execute Changes not staged for commit: lerna ERR! execute modified: lerna.json lerna ERR! execute modified: packages/bar/package.json lerna ERR! execute modified: packages/foo/package.json lerna ERR! execute lerna ERR! execute no changes added to commit lerna ERR! execute lerna ERR! execute at Function.module.exports.sync (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\node_modules\execa\index.js:277:26) lerna ERR! execute at Function.execSync (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\ChildProcessUtilities.js:59:30) lerna ERR! execute at Function.commit (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\GitUtilities.js:84:39) lerna ERR! execute at PublishCommand.gitCommitAndTagVersion (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\commands\PublishCommand.js:612:30) lerna ERR! execute at PublishCommand.commitAndTagUpdates (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\commands\PublishCommand.js:582:27) lerna ERR! execute at PublishCommand.execute (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\commands\PublishCommand.js:261:16) lerna ERR! execute at PublishCommand._attempt (C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\Command.js:289:21) lerna ERR! execute at C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\Command.js:276:15 lerna ERR! execute at C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\Command.js:298:13 lerna ERR! execute at C:\Users\BusDa001\AppData\Roaming\npm\node_modules\lerna\lib\commands\PublishCommand.js:495:11 lerna ERR! execute callback with error lerna ERR! execute { Error: On branch master lerna ERR! execute Your branch is up-to-date with 'origin/master'. lerna ERR! execute Changes not staged for commit: lerna ERR! execute modified: lerna.json lerna ERR! execute modified: packages/bar/package.json lerna ERR! execute modified: packages/foo/package.json

alisd23 added a commit to alisd23/lerna that referenced this issue Aug 9, 2017
This change was missing from the PR: lerna#807
Relates to the issue: lerna#887

Currently running `lerna publish` when no packages need updating causes the task to crash unnecessarily.

This small fix causes the command to complete if no updates are found, instead of trying to continue to the next section.
@evocateur
Copy link
Member

This was fixed in #982

@lock
Copy link

lock bot commented Dec 28, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants