-
Notifications
You must be signed in to change notification settings - Fork 67
Allow plugins to surface output information #1223
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
Comments
Thanks for this @ehmicky - I think returning outputs is closest, as we only want a single summary from each plugin. But outputs could still be returned for multiple stages, so we may want to find a different way, like adding an Also note that we'll likely want structured outputs, similar to the shape of summaries: https://github.com/netlify/netlify-react-ui/issues/4285#issuecomment-620675460 |
Note: we already have an
Note that we could still use a function, but throw if that function is called twice? |
Here is some explorations of the UI I was thinking regarding this! 👉 https://github.com/netlify/netlify-react-ui/issues/4285#issuecomment-624162909 |
About structured information: from this comment, I see the following fields:
Details on API endpoint to communicate this. About ensuring plugins surface information only once:
I suggest the following, which is simple and flexible IMHO:
This also follows the pattern I have mostly seen in existing plugins. Many plugins are doing a Please let me know what you think. |
I think your reasoning makes sense on all points, @ehmicky. Regarding which fields should be required, we could actually make Regarding |
I've got a V1 of the API endpoint for this here: https://www.notion.so/netlify/Plugin-Status-API-Spec-4721670531c1470aa95c5831338563d7 It seems like what's required for this endpoint (and the names for those things), is still changing quickly, but I wanted to get something out that Netlify Build and frontend can start working with. I'll update it as we hammer down naming and the shape of inputs. Many of the names I went with for version 1 are shamelessly stolen from https://developer.github.com/v3/checks/runs/. I like that |
@vbrown608 That naming structure sounds great! Makes sense to keep consistency across platforms. |
@verythorough This makes sense! So the API would be: module.exports = {
onPostBuild({ utils: { status } }) {
doStuff()
status.show({
title: '5 files processed',
summary: 'We're done!',
text: 'Details on what happened',
})
}
} @vbrown608 Let's use those words :) Let's just make sure we are using those words also in front-end @nasivuela and product. Different words make things confusing. So that would be:
|
And for a bit more detail on the "optional" handling:
Looking at GitHub's docs for their outputs object, I see that they set the |
Totally makes sense to me from the perspective of the Netlify Build Note to myself for Monday: we should create a ticket about supporting rich text for some of those fields, eg via Markdown. Should involve frontend. |
Actually from the perspective of the From the API standpoint, we definitely need all fields optional since some Build plugins won't call that |
For me, I +1 Jessica's suggestion above, but I would add I'm open to having the all the fields optional, with the caveat that we provide default messages for the |
I agree: providing a default |
I see the naming has changed. FE can map the names to make it compatible with our current Deploy Summary Item. cc @charliegerard From FE perspective:
Current optional/required on summary:
|
I think we need to distinguish requiredness from a plugin author standpoint and from the front-end standpoint. For example, all fields could be optional for plugin authors (and they actually have to if we want to maintain backward compatibility with existing plugins). However, default values can be assigned somewhere in the middle (e.g. by the API) so that, from a front-end standpoint, they are always set without having to make an additional API call. |
Current PRs to implement Also created issues:
|
We discussed to confirm the following:
|
I would like to add one more point from my understanding, let me know if it's right:
|
For the UI
|
For failed plugins: Yes, there should always be a I think we named the fourth state |
This feature is now complete. There were quite many PRs (see the list above this comment) mostly related to:
|
Follow-up from #711, #735, https://github.com/netlify/netlify-react-ui/issues/4285 and discussions with @mheffner, @vbrown608 and @Benaiah.
At the moment, plugins can only communicate the following information:
build.command
failPlugin
,failBuild
,cancelBuild
We need to additionally let plugins communicate "outputs": summaries of success information, less verbose than build logs, and to be surfaced in the UI deploy summary.
One question we were unclear about: whether those outputs should allow including artifacts/blobs for download. The text below assumes no artifacts for GA.
Another question was about local/CLI builds. I am assuming the following: while outputs will be shown in the UI deploy summary, in local/CLI builds, they will be printed on the console instead, at the end of the build.
This is my suggestion for how Build plugins would do this. I think it is important to convey to plugin authors that this is not the same as doing a
console.log()
. In particular, we want to avoid overwhelming users with too many outputs in the UI. One way to convey those semantics (as discussed with @mheffner @vbrown608 @Benaiah) would be to make Build pluginsreturn
outputs.An alternative would be to provide an
utils
method that can only be triggered once per event handler. This option might be more flexible to future product requirements (attaching artifacts, etc.), i.e. IMHO this might be better.When using several event handlers, those outputs would be aggregated for a given plugin. Outputs would not be available as inputs of other plugins: the goal here is only to show information to users, not cross-plugin communication. The aggregated outputs would be send to Bitballoon API at the end of the build.
Please let me know what you think!
The text was updated successfully, but these errors were encountered: