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

feat: expose provenance transparency url #6428

Merged

Conversation

JamesHenry
Copy link
Contributor

I was able to add support for provenance in lerna yesterday (now available in v6.6.2) but libnpmpublish currently only emits a log with the transparency log URL, it does not expose it as data for us to use.

This is a particularly a problem for lerna, because we often deal with publishing many packages concurrently. These publish requests are kicked off eagerly in parallel, and so it is currently not possible to reconcile the logs to their originating package.

The presence of this URL data would allow me to easily differentiate between packages which were published with provenance and those which weren't, as well as recreate the log on the lerna side.

For now the best I can do via log interception is gather up the unique URLs and print them at the very end:

image

I have gone for a rather rudimentary "bolt it on the npmFetch response" approach here, but it would definitely get me what I need. Let me know if you want to rename the property or apply it within some other existing structure on the response in some way.

References

@JamesHenry JamesHenry requested a review from a team as a code owner May 5, 2023 12:15
@JamesHenry JamesHenry changed the title chore(libnpmpublish): expose provenance transparency url feat(libnpmpublish): expose provenance transparency url May 5, 2023
@JamesHenry JamesHenry force-pushed the surface-provenance-transparency-url branch from 196ada5 to 76dc9c3 Compare May 5, 2023 12:16
@wraithgar
Copy link
Member

I think attaching the metadata to the response object is the cleanest way to get that information back to the consumer. Good choice.

The non-409 retry block needs the same logic.

@wraithgar wraithgar changed the title feat(libnpmpublish): expose provenance transparency url feat: expose provenance transparency url May 5, 2023
@JamesHenry
Copy link
Contributor Author

Thanks @wraithgar, applied that change

@JamesHenry
Copy link
Contributor Author

@wraithgar Thank you!

@wraithgar wraithgar merged commit bdab631 into npm:latest May 5, 2023
@wraithgar
Copy link
Member

No, thank you! This'll go out w/ the next cli release (currently scheduled for May 17)

@github-actions github-actions bot mentioned this pull request May 5, 2023
@JamesHenry JamesHenry deleted the surface-provenance-transparency-url branch May 10, 2023 14:38
@ghiscoding
Copy link

@JamesHenry correct me if I'm wrong but I think this change was never applied to Lerna itself, right? I assume you were waiting for an official libnpmpublish release for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants