Skip to content

[rush] regression -- publish now fails for new packages #4848

@sam-mfb

Description

@sam-mfb

Summary

We have a pipeline script that publishes all packages marked with a certain versionPolicy to an azure artifact feed, as follows:

node common/scripts/install-run-rush.js publish --publish --include-all --version-policy $(publishVersionPolicy)

This has worked fine for a long time, but recently we created a new package in our monorepo and the pipeline now fails with the following message:

Failed to get NPM information about @scope/package.

ERROR: The command failed with exit code 1
npm error code E404
npm error 404 Not Found - GET
https://pkgs.dev.azure.com/MYORG/_packaging/MyOrg_Internal_Registry/npm/registry/@scopeb%2fpackage
- The package '@scope/package' was not found in feed
'MyOrg_Internal_Registry'
npm error 404
npm error 404  '@scope/package@*' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

This problem can be reproduced in the debugger by invoking getPublishedVersionsAsync() on a nonexistent package name.

Per discussion on the zulip forum, the expected behavior is that a 404 would be handled and deemed a case of the version not existing and so publication would be allowed, via this code

According to Pete Gonzales, this look like a regression from PR #4350 last month, which replaced Utilities._processResult(result) with Executable.waitForExitAsync(), and in doing so got rid of this code:

  private static _processResult({
    error,
    stderr,
    status
  }: {
    error: Error | undefined;
    stderr: string;
    status: number | null;
  }): void {
    if (error) {
      error.message += `\n${stderr}`;
      if (status) {
        error.message += `\nExited with status ${status}`;
      }

      throw error;
    }

    if (status) {
      throw new Error(`The command failed with exit code ${status}\n${stderr}`);
    }
  }

As a result, the searched string is now just Process exited with code 1 instead of the STDERR buffer that would match E404.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as intended

Type

No type

Projects

Status

High priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions