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

Add allowPackageConflicts for npm publish #12482

Closed
wants to merge 2 commits into from

Conversation

eriksteinebach
Copy link

Adding the ability to allow package conflicts on publishing to npm build. This support the scenario where npm packages gets published from a larger build, where not every build updates the npm package. In this case, if the npm package version has not been updated, the npm package doesn't need to be published and the build can just continue.

The current behavior is that npm fails with a 403 Forbidden. "The feed already contains the package 'packageName' at version 'x.x.x'. This causes the build to be red, or when "continue on error" is set on the task, the build is yellow. We would like the build to be green, because there is no need to publish a new version.

We try here to mimic the behavior from the nuget publish task. When the allowPackageConflicts property is set on the task, this task completes successfully when the package version has already been published.

I was not able to build or test the project locally, because of an error during the build step (#11136), so I am hoping a build will run for this PR. If so I will update the PR based on the build results.

@msftclas
Copy link

msftclas commented Mar 4, 2020

CLA assistant check
All CLA requirements met.

@eriksteinebach
Copy link
Author

I tried getting a green unittest. Because I cannot build the solution locally I rely on the PR build results to debug any issues (which doesn't give the exception that is accuring). But as far as I can understand my new unittest should result in a succeeded task (together with my changed code). I don't explicitly set succeeded, but this wasn't done before either, so I want to leave this the same. It should walk the same path as a unittest where allowPackageConflicts is set to false, but it seems that it doesn't.

@bcldvd
Copy link

bcldvd commented Aug 13, 2020

I'd be inclined to have the default behavior be to check latest published version, and not try to publish if the version already exists

@satbai
Copy link
Contributor

satbai commented Aug 13, 2020

To work around the issue, you can use the Npm Authenticate task after which you can add a script task to run any npm command you need to. Npm Authenticate task is recommended over the Npm task.

@github-actions
Copy link

This PR is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the PR otherwise this will be closed in 5 days

@github-actions github-actions bot added the stale label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants