-
Notifications
You must be signed in to change notification settings - Fork 0
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: add alwaysPrintInCI
option
#76
Conversation
The `CIMultiStageOutput` class was caching dynamic blocks by their label, then calculating wether or not to print new info based on the throttle time and causing it to miss printing new dynamic stage data if the throttle time is bigger than the time new data arrives.
src/multi-stage-output.tsx
Outdated
@@ -294,7 +294,7 @@ class CIMultiStageOutput<T extends Record<string, unknown>> { | |||
|
|||
const formattedData = info.get ? info.get(this.data as T) : undefined | |||
if (!formattedData) continue | |||
const key = info.type === 'message' ? formattedData : info.label | |||
const key = info.type === 'message' ? formattedData : `${info.label}: ${formattedData}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key will include dynamic data so new output based on updated data will always be printed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key is only the label for dynamic data because, otherwise, it will print on every single update - which is what we wanted to avoid
Run OCLIF_CI_UPDATE_FREQUENCY_MS=500 CI=true tsx examples/sf-specific/deploy.ts
before and after your change to get an idea of the difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thinking out loud here: I wonder if our best option is to add a new option to InfoBlock
that will tell the CI output to always print - regardless of it the update timeout has been met or not.
So something like this:
{
label: 'Successful',
get: (data): string | undefined => {
// formatting stuff here
}
},
{
label: 'Failed',
alwaysPrintInCI: true,
get: (data): string | undefined => {
// formatting stuff here
}
}
That way customers always get updates Failed
but only intermittently get updates to Successful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run OCLIF_CI_UPDATE_FREQUENCY_MS=500 CI=true tsx examples/sf-specific/deploy.ts before and after your change to get an idea of the difference
ohh I see now.
Just thinking out loud here: I wonder if our best option is to add a new option to InfoBlock that will tell the CI output to always print - regardless of it the update timeout has been met or not.
I like that option, I was struggling in PDR trying to find why updates were missing til I found about the throttle env affected it (which lead me to make this change first).
With the new option, the InfoBlock getters would need explicitly handle possible duplicates like this:
https://github.com/salesforcecli/plugin-deploy-retrieve/blob/fcc83af585eca9fc8f47db48a827a645e7fed116/src/utils/deployStages.ts#L161C1-L168C16
I'll add it in a bit 👍🏼
src/multi-stage-output.tsx
Outdated
@@ -294,7 +294,7 @@ class CIMultiStageOutput<T extends Record<string, unknown>> { | |||
|
|||
const formattedData = info.get ? info.get(this.data as T) : undefined | |||
if (!formattedData) continue | |||
const key = info.type === 'message' ? formattedData : info.label | |||
const key = info.type === 'message' ? formattedData : `${info.label}: ${formattedData}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key is only the label for dynamic data because, otherwise, it will print on every single update - which is what we wanted to avoid
Run OCLIF_CI_UPDATE_FREQUENCY_MS=500 CI=true tsx examples/sf-specific/deploy.ts
before and after your change to get an idea of the difference
alwaysPrintInCI
option
Found this bug while working on https://github.com/salesforcecli/plugin-deploy-retrieve/pull/1215/files
Adds new
alwaysPrintInCI
option suggested here:#76 (comment)
it only affects CI output, if an info block sets it to true then all updates will be rendered (to avoid possible duplicates consumers need to handle that in the info block getter).
@W-17203886@