dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
203 stars 36 forks source link

Is it possible to add the --debug arg to be passed to semantic-release? #24

Closed ghost closed 4 years ago

ghost commented 4 years ago

The semantic-release command has a --debug arg that can be passed to it. Is there any way to have debug output from msr or semantic-release?

I'm noticing strange behaviour from msr where it just hangs forever, but randomly works as well. So I'm trying to find out what the issue is.

antongolub commented 4 years ago

I think we could add standard debugging mechanics.

ghost commented 4 years ago

What about the hanging behaviour? could it be related to --execasync that's mentioned in the README?

ghost commented 4 years ago

Here's a good example . As you can see the first command completes successfully in 6 seconds. I then instantly run the command again and it hangs for around 3 mins before I interrupt the command.

:: npm run release

> test-devops@1.0.0 release ..../test-devops
> multi-semantic-release

multi-semantic-release version: 2.2.0
semantic-release version: 17.1.1
yarn paths [
  '../test-devops/Terraform/OncePerAccount/package.json',
  '../test-devops/Terraform/OncePerAppPerEnvironment/package.json',
  '../test-devops/Terraform/OncePerEnvironment/package.json'
]
[15:10:52] › 🎉  Started multirelease! Loading 3 packages...
[15:10:52] › ✔  Loaded package onceperaccount
[15:10:52] › ✔  Loaded package onceperappperenvironment
[15:10:52] › ✔  Loaded package onceperenvironment
[15:10:52] › 🎉  Queued 3 packages! Starting release...
[15:10:52] [onceperaccount] › ℹ  Running semantic-release version 17.1.1
[15:10:52] [onceperappperenvironment] › ℹ  Running semantic-release version 17.1.1
[15:10:52] [onceperenvironment] › ℹ  Running semantic-release version 17.1.1
[15:10:52] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:10:52] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[15:10:52] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:10:52] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[15:10:52] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:10:52] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[15:10:56] [onceperappperenvironment] › ✔  Run automated release from branch master on repository ..../test-devops.git
[15:10:56] [onceperenvironment] › ✔  Run automated release from branch master on repository ../test-devops.git
[15:10:57] [onceperaccount] › ✔  Run automated release from branch master on repository ../test/-devops.git
[15:10:57] [onceperappperenvironment] › ✔  Allowed to push to the Git repository
[15:10:57] [onceperappperenvironment] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperappperenvironment] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperappperenvironment] › ℹ  Found git tag onceperappperenvironment@1.0.1 associated with version 1.0.1 on branch master
[15:10:57] [onceperappperenvironment] › ℹ  Found 0 commits since last release
[15:10:57] [onceperappperenvironment] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
[15:10:57] [onceperenvironment] › ✔  Allowed to push to the Git repository
[15:10:57] [onceperenvironment] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperenvironment] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperenvironment] › ℹ  Found git tag onceperenvironment@1.0.0 associated with version 1.0.0 on branch master
[15:10:57] [onceperaccount] › ✔  Allowed to push to the Git repository
[15:10:57] [onceperaccount] › ℹ  Start step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperaccount] › ✔  Completed step "verifyConditions" of plugin "Inline plugin"
[15:10:57] [onceperenvironment] › ℹ  Found 3 commits since last release
[15:10:57] [onceperenvironment] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
[15:10:57] [onceperaccount] › ℹ  Found git tag onceperaccount@1.0.0 associated with version 1.0.0 on branch master
[15:10:58] [onceperaccount] › ℹ  Found 4 commits since last release
[15:10:58] [onceperaccount] › ℹ  Start step "analyzeCommits" of plugin "Inline plugin"
[15:10:58] [onceperappperenvironment] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[15:10:58] [onceperenvironment] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[15:10:58] [onceperaccount] › ✔  Completed step "analyzeCommits" of plugin "Inline plugin"
[15:10:58] [onceperappperenvironment] › ℹ  There are no relevant changes, so no new version is released.
[15:10:58] [onceperenvironment] › ℹ  There are no relevant changes, so no new version is released.
[15:10:58] [onceperaccount] › ℹ  There are no relevant changes, so no new version is released.
[15:10:58] › 🎉  Released 0 of 3 packages, semantically!
../test-devops  test-devops.git  (master)  tf:default  
:: npm run release

> test-devops@1.0.0 release ../test-devops
> multi-semantic-release

multi-semantic-release version: 2.2.0
semantic-release version: 17.1.1
yarn paths [
  '../test-devops/Terraform/OncePerAccount/package.json',
  '../test-devops/Terraform/OncePerAppPerEnvironment/package.json',
  '../test-devops/Terraform/OncePerEnvironment/package.json'
]
[15:11:00] › 🎉  Started multirelease! Loading 3 packages...
[15:11:00] › ✔  Loaded package onceperaccount
[15:11:00] › ✔  Loaded package onceperappperenvironment
[15:11:00] › ✔  Loaded package onceperenvironment
[15:11:00] › 🎉  Queued 3 packages! Starting release...
[15:11:01] [onceperaccount] › ℹ  Running semantic-release version 17.1.1
[15:11:01] [onceperappperenvironment] › ℹ  Running semantic-release version 17.1.1
[15:11:01] [onceperenvironment] › ℹ  Running semantic-release version 17.1.1
[15:11:01] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:11:01] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[15:11:01] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:11:01] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
[15:11:01] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[15:11:01] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
ç^C../test-devops  test-devops.git  (master)  tf:default  
:: date
Fri 17 Jul 2020 15:13:56 BST
../test-devops  test-devops.git  (master)  tf:default  
antongolub commented 4 years ago

@musaabal-okaidi It looks like semrel hangs right after resolving its config. Could you enable debug?

Output debugging information. This can also be enabled by setting the DEBUG environment variable to semantic-release:*

It's very interesting what happens here:

  // Verify config
  await verify(context);

  options.repositoryUrl = await getGitAuthUrl({...context, branch: {name: ciBranch}});
  context.branches = await getBranches(options.repositoryUrl, ciBranch, context);
  context.branch = context.branches.find(({name}) => name === ciBranch);
ghost commented 4 years ago

First attempt straight after I read your comment worked.

Then the next attempt hung, but it seems like it went a bit further. See the output below.

:: npm run release

> test-devops@1.0.0 release ../test-devops
> multi-semantic-release

multi-semantic-release version: 2.2.0
semantic-release version: 17.1.1
yarn paths [
  '../test-devops/Terraform/OncePerAccount/package.json',
  '../test-devops/Terraform/OncePerAppPerEnvironment/package.json',
  '../test-devops/Terraform/OncePerEnvironment/package.json'
]
[16:29:43] › 🎉  Started multirelease! Loading 3 packages...
  semantic-release:config load config from: ../test-devops/.releaserc +0ms
  semantic-release:config load config from: ../test-devops/.releaserc +1ms
  semantic-release:config load config from: ../test-devops/.releaserc +1ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'v${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true
  semantic-release:config } +23ms
  semantic-release:plugins options for @semantic-release/changelog/verifyConditions: {} +0ms
  semantic-release:plugins options for @semantic-release/git/verifyConditions: {} +1ms
  semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} +1ms
  semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: { preset: 'angular', host: 'http://cxyz/' } +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
  semantic-release:plugins options for @semantic-release/git/prepare: {} +1ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'v${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true
  semantic-release:config } +123ms
  semantic-release:plugins options for @semantic-release/changelog/verifyConditions: {} +2ms
  semantic-release:plugins options for @semantic-release/git/verifyConditions: {} +1ms
  semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} +0ms
  semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: { preset: 'angular', host: 'http://cxyz/' } +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
  semantic-release:plugins options for @semantic-release/git/prepare: {} +0ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'v${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true
  semantic-release:config } +3ms
  semantic-release:plugins options for @semantic-release/changelog/verifyConditions: {} +2ms
  semantic-release:plugins options for @semantic-release/git/verifyConditions: {} +1ms
  semantic-release:plugins options for @semantic-release/commit-analyzer/analyzeCommits: {} +0ms
  semantic-release:plugins options for @semantic-release/release-notes-generator/generateNotes: { preset: 'angular', host: 'http://cxyz/' } +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
  semantic-release:plugins options for @semantic-release/git/prepare: {} +1ms
[16:29:43] › ✔  Loaded package onceperaccount
[16:29:43] › ✔  Loaded package onceperappperenvironment
[16:29:43] › ✔  Loaded package onceperenvironment
[16:29:43] › 🎉  Queued 3 packages! Starting release...
[16:29:43] [onceperaccount] › ℹ  Running semantic-release version 17.1.1
[16:29:43] [onceperappperenvironment] › ℹ  Running semantic-release version 17.1.1
[16:29:43] [onceperenvironment] › ℹ  Running semantic-release version 17.1.1
  semantic-release:config load config from: ../test-devops/.releaserc +63ms
  semantic-release:config load config from: ../test-devops/.releaserc +0ms
  semantic-release:config load config from: ../test-devops/.releaserc +1ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'onceperaccount@${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true,
  semantic-release:config   verifyConditions: [AsyncFunction: verifyConditions] { pluginName: 'Inline plugin' },
  semantic-release:config   analyzeCommits: [AsyncFunction: analyzeCommits] { pluginName: 'Inline plugin' },
  semantic-release:config   generateNotes: [AsyncFunction: generateNotes] { pluginName: 'Inline plugin' },
  semantic-release:config   publish: [AsyncFunction: publish] { pluginName: 'Inline plugin' },
  semantic-release:config   _pkgOptions: {
  semantic-release:config     branches: [
  semantic-release:config       '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config       'master',
  semantic-release:config       'next',
  semantic-release:config       'next-major',
  semantic-release:config       [Object],
  semantic-release:config       [Object]
  semantic-release:config     ],
  semantic-release:config     repositoryUrl: 'test-devops.got',
  semantic-release:config     tagFormat: 'v${version}',
  semantic-release:config     plugins: [
  semantic-release:config       '@semantic-release/commit-analyzer',
  semantic-release:config       [Array],
  semantic-release:config       '@semantic-release/changelog',
  semantic-release:config       '@semantic-release/git'
  semantic-release:config     ],
  semantic-release:config     dryRun: false,
  semantic-release:config     ci: false,
  semantic-release:config     noCi: true
  semantic-release:config   }
  semantic-release:config } +16ms
  semantic-release:plugins options for Inline plugin/verifyConditions: {} +79ms
  semantic-release:plugins options for Inline plugin/analyzeCommits: {} +1ms
  semantic-release:plugins options for Inline plugin/generateNotes: {} +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
[16:29:43] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
  semantic-release:plugins options for @semantic-release/git/prepare: {} +1ms
[16:29:43] [onceperaccount] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
  semantic-release:plugins options for Inline plugin/publish: {} +0ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'onceperenvironment@${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true,
  semantic-release:config   verifyConditions: [AsyncFunction: verifyConditions] { pluginName: 'Inline plugin' },
  semantic-release:config   analyzeCommits: [AsyncFunction: analyzeCommits] { pluginName: 'Inline plugin' },
  semantic-release:config   generateNotes: [AsyncFunction: generateNotes] { pluginName: 'Inline plugin' },
  semantic-release:config   publish: [AsyncFunction: publish] { pluginName: 'Inline plugin' },
  semantic-release:config   _pkgOptions: {
  semantic-release:config     branches: [
  semantic-release:config       '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config       'master',
  semantic-release:config       'next',
  semantic-release:config       'next-major',
  semantic-release:config       [Object],
  semantic-release:config       [Object]
  semantic-release:config     ],
  semantic-release:config     repositoryUrl: 'test-devops.got',
  semantic-release:config     tagFormat: 'v${version}',
  semantic-release:config     plugins: [
  semantic-release:config       '@semantic-release/commit-analyzer',
  semantic-release:config       [Array],
  semantic-release:config       '@semantic-release/changelog',
  semantic-release:config       '@semantic-release/git'
  semantic-release:config     ],
  semantic-release:config     dryRun: false,
  semantic-release:config     ci: false,
  semantic-release:config     noCi: true
  semantic-release:config   }
  semantic-release:config } +11ms
  semantic-release:plugins options for Inline plugin/verifyConditions: {} +8ms
  semantic-release:plugins options for Inline plugin/analyzeCommits: {} +0ms
  semantic-release:plugins options for Inline plugin/generateNotes: {} +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
[16:29:43] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
  semantic-release:plugins options for @semantic-release/git/prepare: {} +1ms
[16:29:43] [onceperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
  semantic-release:plugins options for Inline plugin/publish: {} +0ms
  semantic-release:config options values: {
  semantic-release:config   branches: [
  semantic-release:config     '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config     'master',
  semantic-release:config     'next',
  semantic-release:config     'next-major',
  semantic-release:config     { name: 'beta', prerelease: true },
  semantic-release:config     { name: 'alpha', prerelease: true }
  semantic-release:config   ],
  semantic-release:config   repositoryUrl: 'test-devops.got',
  semantic-release:config   tagFormat: 'onceperappperenvironment@${version}',
  semantic-release:config   plugins: [
  semantic-release:config     '@semantic-release/commit-analyzer',
  semantic-release:config     [ '@semantic-release/release-notes-generator', [Object] ],
  semantic-release:config     '@semantic-release/changelog',
  semantic-release:config     '@semantic-release/git'
  semantic-release:config   ],
  semantic-release:config   dryRun: false,
  semantic-release:config   ci: false,
  semantic-release:config   noCi: true,
  semantic-release:config   verifyConditions: [AsyncFunction: verifyConditions] { pluginName: 'Inline plugin' },
  semantic-release:config   analyzeCommits: [AsyncFunction: analyzeCommits] { pluginName: 'Inline plugin' },
  semantic-release:config   generateNotes: [AsyncFunction: generateNotes] { pluginName: 'Inline plugin' },
  semantic-release:config   publish: [AsyncFunction: publish] { pluginName: 'Inline plugin' },
  semantic-release:config   _pkgOptions: {
  semantic-release:config     branches: [
  semantic-release:config       '+([0-9])?(.{+([0-9]),x}).x',
  semantic-release:config       'master',
  semantic-release:config       'next',
  semantic-release:config       'next-major',
  semantic-release:config       [Object],
  semantic-release:config       [Object]
  semantic-release:config     ],
  semantic-release:config     repositoryUrl: 'test-devops.got',
  semantic-release:config     tagFormat: 'v${version}',
  semantic-release:config     plugins: [
  semantic-release:config       '@semantic-release/commit-analyzer',
  semantic-release:config       [Array],
  semantic-release:config       '@semantic-release/changelog',
  semantic-release:config       '@semantic-release/git'
  semantic-release:config     ],
  semantic-release:config     dryRun: false,
  semantic-release:config     ci: false,
  semantic-release:config     noCi: true
  semantic-release:config   }
  semantic-release:config } +7ms
  semantic-release:plugins options for Inline plugin/verifyConditions: {} +6ms
  semantic-release:plugins options for Inline plugin/analyzeCommits: {} +1ms
  semantic-release:plugins options for Inline plugin/generateNotes: {} +0ms
  semantic-release:plugins options for @semantic-release/changelog/prepare: {} +0ms
[16:29:43] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
  semantic-release:plugins options for @semantic-release/git/prepare: {} +0ms
[16:29:43] [onceperappperenvironment] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
  semantic-release:plugins options for Inline plugin/publish: {} +0ms
antongolub commented 4 years ago

Nothing comes to mind. Perhaps the problem relates shared streams and process spawns. We'll experiment with that anyway.

antongolub commented 4 years ago

@musaabal-okaidi

I've added sequential-init flag to avoid hypothetical concurrent initialization collisions. Canary build: @qiwi/multi-semantic-release@3.4.0

ghost commented 4 years ago

Thanks. I'll give it a go tomorrow morning.

ghost commented 4 years ago

Hi @antongolub

Still the same. it works sometimes and sometimes it fails.

Although the node version might be of more importance, I did also try running the tool from a Windows machine just in case the Mac was causing any issue, but I still got the same behaviour.

See the output below. It contains additional stacktrace that gets printed it when I kill the process with CTRL+C. I didn't include this last week.

$ npm run release

> test-devops@1.0.0 release C:\Users\Musaab\tmp\devops
> multi-semantic-release

multi-semantic-release version: 3.4.0
semantic-release version: 17.1.1
yarn paths [
  'C:\\Users\\Musaab\\tmp\\devops\\Terraform\\OncePerAccount\\package.json',
  'C:\\Users\\Musaab\\tmp\\devops\\Terraform\\OncePerAppPerEnvironment\\package.json',
  'C:\\Users\\Musaab\\tmp\\devops\\Terraform\\OncePerEnvironment\\package.json'
]
[09:55:09] ┬╗ ­ƒÄë  Started multirelease! Loading 3 packages...
[09:55:09] ┬╗ ÔêÜ  Loaded package onceperaccount
[09:55:09] ┬╗ ÔêÜ  Loaded package onceperappperenvironment
[09:55:09] ┬╗ ÔêÜ  Loaded package onceperenvironment
[09:55:09] ┬╗ ­ƒÄë  Queued 3 packages! Starting release...
[09:55:10] [onceperaccount] ┬╗ i  Running semantic-release version 17.1.1
[09:55:10] [onceperappperenvironment] ┬╗ i  Running semantic-release version 17.1.1
[09:55:10] [onceperenvironment] ┬╗ i  Running semantic-release version 17.1.1
[09:55:10] [onceperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[09:55:10] [onceperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[09:55:10] [onceperaccount] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[09:55:10] [onceperaccount] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[09:55:10] [onceperappperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[09:55:10] [onceperappperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[09:59:40] [onceperappperenvironment] » ×  An error occurred while running semantic-release: Error: Command failed with exit code 128: git ls-remote --heads git@code.local:test/devops.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at makeError (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\node_modules\execa\lib\error.js:59:11)
    at handlePromise (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\node_modules\execa\index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getBranches (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\git.js:66:11)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\branches\expand.js:6:23)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\branches\index.js:14:26)
    at async run (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\index.js:57:22)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\index.js:260:22)
    at async releasePackage (C:\Users\Musaab\tmp\devops\node_modules\@qiwi\multi-semantic-release\lib\multiSemanticRelease.js:183:15)
    at async Promise.all (index 1) {
  shortMessage: 'Command failed with exit code 128: git ls-remote --heads git@code.local:test/devops.git',
  command: 'git ls-remote --heads git@code.local:test/devops.git',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'fatal: Could not read from remote repository.\n' +
    '\n' +
    'Please make sure you have the correct access rights\n' +
    'and the repository exists.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
[multi-semantic-release]: Error: Command failed with exit code 128: git ls-remote --heads git@code.local:test/devops.git
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at makeError (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\node_modules\execa\lib\error.js:59:11)
    at handlePromise (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\node_modules\execa\index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getBranches (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\git.js:66:11)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\branches\expand.js:6:23)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\lib\branches\index.js:14:26)
    at async run (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\index.js:57:22)
    at async module.exports (C:\Users\Musaab\tmp\devops\node_modules\semantic-release\index.js:260:22)
    at async releasePackage (C:\Users\Musaab\tmp\devops\node_modules\@qiwi\multi-semantic-release\lib\multiSemanticRelease.js:183:15)
    at async Promise.all (index 1) {
  shortMessage: 'Command failed with exit code 128: git ls-remote --heads git@code.local:test/devops.git',
  command: 'git ls-remote --heads git@code.local:test/devops.git',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'fatal: Could not read from remote repository.\n' +
    '\n' +
    'Please make sure you have the correct access rights\n' +
    'and the repository exists.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-devops@1.0.0 release: `multi-semantic-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-devops@1.0.0 release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Musaab\AppData\Roaming\npm-cache\_logs\2020-07-20T08_59_40_768Z-debug.log
antongolub commented 4 years ago

@musaabal-okaidi Where is the flag? multi-semantic-release --sequential-init

ghost commented 4 years ago

Sorry I didn't realise it was a cmdline arg/flag. I thought you where referring to something within your code.

Anyway, I've tried it again, but it's still the same. The command took 11 mins, then it exited on its own.

$ npm run release

> test-devops@1.0.0 release C:\Users\Musaab\tmp\test-devops
> multi-semantic-release --sequential-init

multi-semantic-release version: 3.4.0
semantic-release version: 17.1.1
yarn paths [
  'C:\\Users\\Musaab\\tmp\\test-devops\\Terraform\\OncePerAccount\\package.json',
  'C:\\Users\\Musaab\\tmp\\test-devops\\Terraform\\OncePerAppPerEnvironment\\package.json',
  'C:\\Users\\Musaab\\tmp\\test-devops\\Terraform\\OncePerEnvironment\\package.json'
]
[10:23:19] ┬╗ ­ƒÄë  Started multirelease! Loading 3 packages...
[10:23:20] ┬╗ ÔêÜ  Loaded package onceperaccount
[10:23:20] ┬╗ ÔêÜ  Loaded package onceperappperenvironment
[10:23:20] ┬╗ ÔêÜ  Loaded package onceperenvironment
[10:23:20] ┬╗ ­ƒÄë  Queued 3 packages! Starting release...
[10:23:20] [onceperaccount] ┬╗ i  Running semantic-release version 17.1.1
[10:23:20] [onceperaccount] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[10:23:20] [onceperaccount] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[10:23:24] [onceperaccount] ┬╗ ÔêÜ  Run automated release from branch master on repository git@code.local:test/test-devops.git
[10:23:25] [onceperaccount] ┬╗ ÔêÜ  Allowed to push to the Git repository
[10:23:25] [onceperaccount] ┬╗ i  Start step "verifyConditions" of plugin "Inline plugin"
[10:23:26] [onceperappperenvironment] ┬╗ i  Running semantic-release version 17.1.1
[10:23:26] [onceperaccount] ┬╗ ÔêÜ  Completed step "verifyConditions" of plugin "Inline plugin"
[10:23:26] [onceperappperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[10:23:26] [onceperappperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[10:23:26] [onceperaccount] ┬╗ i  Found git tag onceperaccount@1.0.0 associated with version 1.0.0 on branch master
[10:23:26] [onceperaccount] ┬╗ i  Found 6 commits since last release
[10:23:26] [onceperaccount] ┬╗ i  Start step "analyzeCommits" of plugin "Inline plugin"
[10:23:30] [onceperappperenvironment] ┬╗ ÔêÜ  Run automated release from branch master on repository git@code.local:test/test-devops.git
[10:23:31] [onceperappperenvironment] ┬╗ ÔêÜ  Allowed to push to the Git repository
[10:23:31] [onceperappperenvironment] ┬╗ i  Start step "verifyConditions" of plugin "Inline plugin"
[10:23:31] [onceperenvironment] ┬╗ i  Running semantic-release version 17.1.1
[10:23:31] [onceperappperenvironment] ┬╗ ÔêÜ  Completed step "verifyConditions" of plugin "Inline plugin"
[10:23:31] [onceperappperenvironment] ┬╗ i  Found git tag onceperappperenvironment@1.0.1 associated with version 1.0.1 on branch master
[10:23:31] [onceperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/changelog"
[10:23:31] [onceperenvironment] ┬╗ ÔêÜ  Loaded plugin "prepare" from "@semantic-release/git"
[10:23:31] [onceperappperenvironment] ┬╗ i  Found 0 commits since last release
[10:23:31] [onceperappperenvironment] ┬╗ i  Start step "analyzeCommits" of plugin "Inline plugin"
[10:34:38] [onceperenvironment] » ×  An error occurred while running semantic-release: Error: Command failed with exit code 128: git ls-remote --heads git@code.local:test/test-devops.git
kex_exchange_identification: read: Connection reset by peer
Connection reset by x.x.x.x port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at makeError (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\node_modules\execa\lib\error.js:59:11)
    at handlePromise (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\node_modules\execa\index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getBranches (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\git.js:66:11)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\branches\expand.js:6:23)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\branches\index.js:14:26)
    at async run (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\index.js:57:22)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\index.js:260:22)
    at async releasePackage (C:\Users\Musaab\tmp\test-devops\node_modules\@qiwi\multi-semantic-release\lib\multiSemanticRelease.js:183:15)
    at async Promise.all (index 2) {
  shortMessage: 'Command failed with exit code 128: git ls-remote --heads git@code.local:test/test-devops.git',
  command: 'git ls-remote --heads git@code.local:test/test-devops.git',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'kex_exchange_identification: read: Connection reset by peer\r\n' +
    'Connection reset by x.x.x.x port 22\r\n' +
    'fatal: Could not read from remote repository.\n' +
    '\n' +
    'Please make sure you have the correct access rights\n' +
    'and the repository exists.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
[multi-semantic-release]: Error: Command failed with exit code 128: git ls-remote --heads git@code.local:test/test-devops.git
kex_exchange_identification: read: Connection reset by peer
Connection reset by x.x.x.x port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at makeError (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\node_modules\execa\lib\error.js:59:11)
    at handlePromise (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\node_modules\execa\index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getBranches (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\git.js:66:11)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\branches\expand.js:6:23)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\lib\branches\index.js:14:26)
    at async run (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\index.js:57:22)
    at async module.exports (C:\Users\Musaab\tmp\test-devops\node_modules\semantic-release\index.js:260:22)
    at async releasePackage (C:\Users\Musaab\tmp\test-devops\node_modules\@qiwi\multi-semantic-release\lib\multiSemanticRelease.js:183:15)
    at async Promise.all (index 2) {
  shortMessage: 'Command failed with exit code 128: git ls-remote --heads git@code.local:test/test-devops.git',
  command: 'git ls-remote --heads git@code.local:test/test-devops.git',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'kex_exchange_identification: read: Connection reset by peer\r\n' +
    'Connection reset by x.x.x.x port 22\r\n' +
    'fatal: Could not read from remote repository.\n' +
    '\n' +
    'Please make sure you have the correct access rights\n' +
    'and the repository exists.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-devops@1.0.0 release: `multi-semantic-release --sequential-init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-devops@1.0.0 release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Musaab\AppData\Roaming\npm-cache\_logs\2020-07-20T09_34_38_132Z-debug.log

I've also tried running semantic-release directly in each package using lerna exec and interestingly I noticed the same behaviour. So the underlying issue seems to be with semantic-release I guess. I never got this behaviour when I was running semantic-release in the root of the repo before I started using with multi-semantic-release

lerna exec --concurrency 1 "semantic-release" 
info cli using local version of lerna
lerna notice cli v3.22.1
lerna info versioning independent
lerna info ci enabled
lerna info Executing command in 3 packages: "semantic-release"
[10:34:31] [semantic-release] › ℹ  Running semantic-release version 17.1.1
[10:34:31] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[10:34:31] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[10:34:31] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[10:34:31] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[10:34:31] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[10:34:31] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
^C
~/test-devops  code.local:test/test-devops.git  (master)  tf:default  
:: date
Mon 20 Jul 2020 10:37:22 BST

Another example


:: semantic-release 
[10:59:14] [semantic-release] › ℹ  Running semantic-release version 17.1.1
[10:59:14] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[10:59:14] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/git"
[10:59:14] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[10:59:14] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[10:59:14] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/changelog"
[10:59:14] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/git"
çç^C
~/test-devops  code.local:test/test-devops.git  (master)  tf:default  
:: date
Mon 20 Jul 2020 11:36:04 BST
antongolub commented 4 years ago
[10:23:31] [onceperappperenvironment] ┬╗ i  Start step "analyzeCommits" of plugin "Inline plugin"
[10:34:38] [onceperenvironment] » ×  An error occurred while running semantic-release: Error: Command failed with exit code 128: git ls-remote --heads git@code.local:test/test-devops.git
kex_exchange_identification: read: Connection reset by peer

Hmm... Could it be some kind of network problem, firewall or something similar?

semantic-release\index.js:57:22

context.branches = await getBranches(options.repositoryUrl, ciBranch, context);

semantic-release\lib\git.js:66:11

return (await execa('git', ['ls-remote', '--heads', repositoryUrl], execaOptions)).stdout
    .split('\n')
    .filter(Boolean)
    .map((branch) => branch.match(/^.+refs\/heads\/(?<branch>.+)$/)[1]);
ghost commented 4 years ago

Certainly looks like it, but as soon as I kill the process and immediately start it again it works so it doesn't really make sense. My network settings, connections and configurations do not change at all between the each command execution.

Either way I guess there's not much you could do as it's an issue isn't with the calls that multi-semantic-release is making.

I'll raise it on the semantic-release repo and see what I get from them. The only issue is they're not too interested in monorepos, and the issue only seems to happen when I run the command in a sub-folder of the repo. I never seem to have that issue when running it in the root folder.

antongolub commented 4 years ago

Crazy, but it might work: switch protocol in repo urls in all package.json files to https.

"repository": {
    "type": "git",
    "url": "git+https://github.com/qiwi/json-rpc.git"
  },

https://medium.com/@shahids89/how-to-fix-ssh-exchange-identification-read-connection-reset-by-peer-error-while-running-jenkins-899394f4049f

ghost commented 4 years ago

That didn't work. However; it definitely seems to be an issue with throttling as multi-semantic-release works when I run the command the first time after not running it for a while, then the subsequent re-runs seem to be more prone to hang.

In a real life scenario, it will not ran that often so we should probably never see the issue, but while testing, it's a bit annoying to have that restriction.

I found this which could be useful if anyone is running a private git server. https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/topics/git/troubleshooting_git.md#ssh_exchange_identification-error

Also, I'm testing multi-semantic-release on my CI server. After running npm i then multi-semantic-release I get this error. Any idea what might it be?

multi-semantic-release version: 3.4.0
[09:22:29]  semantic-release version: 17.1.1
[09:22:29]  [multi-semantic-release]: { Error: 'undefined' is not recognized as an internal or external command,
[09:22:29]  operable program or batch file.
[09:22:29]      at handleError (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\bash-glob\index.js:351:11)
[09:22:29]      at Function.glob.sync (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\bash-glob\index.js:192:11)
[09:22:29]      at C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\bash-glob\index.js:160:29
[09:22:29]      at Array.reduce (<anonymous>)
[09:22:29]      at Function.glob.sync (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\bash-glob\index.js:159:20)
[09:22:29]      at getWorkspacesYarn (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\@qiwi\multi-semantic-release\lib\getWorkspacesYarn.js:26:26)
[09:22:29]      at module.exports (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\@qiwi\multi-semantic-release\bin\runner.js:17:17)
[09:22:29]      at Object.<anonymous> (C:\BuildAgent\work\cb4e656c02e6abb8\node_modules\@qiwi\multi-semantic-release\bin\cli.js:29:1)
[09:22:29]      at Module._compile (internal/modules/cjs/loader.js:778:30)
[09:22:29]      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[09:22:29]    pattern: 'Terraform/*/package.json',
[09:22:29]    options:
[09:22:29]     { cwd: 'C:\\BuildAgent\\work\\cb4e656c02e6abb8',
[09:22:29]       realpath: true,
[09:22:29]       ignore: '**/node_modules/**',
[09:22:29]       normalized: true,
[09:22:29]       windowsVerbatimArguments: true } }
[09:22:29]  npm ERR! code ELIFECYCLE
[09:22:29]  npm ERR! errno 1
[09:22:29]  npm ERR! test-devops@1.0.0 release: `multi-semantic-release`
[09:22:29]  npm ERR! Exit status 1
[09:22:29]  npm ERR! 
[09:22:29]  npm ERR! Failed at the test-devops@1.0.0 release script.
[09:22:29]  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[09:22:29]  
[09:22:29]  npm ERR! A complete log of this run can be found in:
[09:22:29]  npm ERR!     C:\Users\teamcity\AppData\Roaming\npm-cache\_logs\2020-07-20T08_22_28_601Z-debug.log
[09:22:29]  Process exited with code 1
[09:22:29]  Process exited with code 1 (Step: Release (Command Line))
[09:22:30]  Step Release (Command Line) failed
antongolub commented 4 years ago

@musaabal-okaidi Where does where bash refer to?

bash-glob requires bash 4.3 or later

ghost commented 4 years ago

ah makes sense. It worked on a Windows machine that had git bash installed. However; I don't think the CI server has Git bash installed and I don't have admin access.

I'll ask the admins to install git bash then I'll give it another bash (bash in informal British is a "try" or "attempt")😄

ghost commented 4 years ago

@musaabal-okaidi Where does where bash refer to?

bash-glob requires bash 4.3 or later

Thanks. Installing bash made it work.

ghost commented 4 years ago

Crazy, but it might work: switch protocol in repo urls in all package.json files to https.

"repository": {
    "type": "git",
    "url": "git+https://github.com/qiwi/json-rpc.git"
  },

https://medium.com/@shahids89/how-to-fix-ssh-exchange-identification-read-connection-reset-by-peer-error-while-running-jenkins-899394f4049f

This also worked. I wasn't thinking straight yesterday I made the change in the package.json in the root of the project. Today I realised that it should be in each package folder so I updated it and it also worked.

antongolub commented 4 years ago

Nice.

Don't close the ticket, I'll add a debugger anyway.

ghost commented 4 years ago

Sure, I'll leave that to you.

btw, It's not important, but it would be nice if the sequential run was for the whole process and not just the init. The reason I say that is because I think the output would be much more readable if you could see the steps for each package listed together especially if parallel running isn't really a concern which is the case for me.

If that's something you see value in doing then great. If not, then not to worry as it's not major.

Either way, thank you very much for your help on this.

antongolub commented 4 years ago

btw, It's not important, but it would be nice if the sequential run was for the whole process and not just the init.

This can be implemented, but as a result, we will lose cross-package dependency updates. msr automatically creates these patches.

If your monorepository packages are independent (which is a bit weird), you can use pmowrer/semantic-release-monorepo and run releases as a single queue through lerna.

lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo
ghost commented 4 years ago

Thanks. I think I tried semantic-release-monorepo at one stage but I had some issues with it. I may revisit it later. msr is doing the job for me now.

The packages are IaC configurations so they don't necessarily have any dependancies between them.

dhoulb commented 4 years ago

:tada: This issue has been resolved in version 2.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: