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

[server] Allow re-triggering failed Prebuilds #5836

Merged
merged 5 commits into from
Oct 1, 2021

Conversation

jankeromnes
Copy link
Contributor

@jankeromnes jankeromnes commented Sep 23, 2021

Description

  • Make it possible to re-trigger failed or timed out Prebuilds (for the same commit)
  • Only show the option to re-trigger Prebuilds in the UI when it's actually possible, and provide immediate visual feedback upon (re-)triggering
  • Drive-by fix: Show "stopping" prebuild instances as still "running" and not yet "ready" (see community)

Related Issue(s)

Fixes #5771
Fixes #5374

How to test

See #5836 (comment)

Release Notes

Make it possible to re-trigger failed or timed out Prebuilds

/uncc

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 27, 2021

🎰

/werft run

👍 started the job as gitpod-build-jx-allow-retriggering-prebuilds.3

@jankeromnes jankeromnes force-pushed the jx/allow-retriggering-prebuilds branch 3 times, most recently from 35d0061 to 4ade98c Compare September 27, 2021 12:00
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 27, 2021

Note to self:

  • Don't render ItemList ContextMenus when there are no options (looks weird with 0 options, should be omitted instead)

@jankeromnes jankeromnes force-pushed the jx/allow-retriggering-prebuilds branch from 4ade98c to 8a97fd8 Compare September 27, 2021 13:39
@roboquat roboquat added size/L and removed size/M labels Sep 27, 2021
@jankeromnes jankeromnes force-pushed the jx/allow-retriggering-prebuilds branch 11 times, most recently from 8b5709e to 00086db Compare September 28, 2021 15:47
@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 28, 2021

Getting there! 🎉

Screenshot 2021-09-28 at 17 44 59

Final TODOs:

  • Add a Rerun Prebuild button to a failed Prebuild logs page
  • Remove Trigger Prebuild button when it makes no sense (or when the list of Prebuilds isn't empty)

@jankeromnes jankeromnes force-pushed the jx/allow-retriggering-prebuilds branch 2 times, most recently from 8454797 to 95220d4 Compare September 29, 2021 07:35
const p = prebuilds.find(p => p.id === info.id)!;
const r: PrebuildWithStatus = { info, status: p.state };
if (p.error) {
r.error = p.error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@AlexTugarev
Copy link
Member

@gtsiolis, this looks good already, I hope you find some time to check soon.

@gtsiolis
Copy link
Contributor

5orwro

@gtsiolis
Copy link
Contributor

gtsiolis commented Sep 30, 2021

/werft run

👍 started the job as gitpod-build-jx-allow-retriggering-prebuilds.24

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jankeromnes! Took a quick look at the UX changes here. 👀

Left some comment below! 🐈

Curious if this PR really fixes #5771 and #5374. 💭

Approving to unblock merging but holding in case we need to make any further changes.

/hold

{(prebuild?.status === 'aborted' || prebuild?.status === 'timeout' || !!prebuild?.error)
? <button className="flex items-center space-x-2" disabled={isRerunningPrebuild} onClick={rerunPrebuild}>
{isRerunningPrebuild && <img className="h-4 w-4 animate-spin filter brightness-150" src={Spinner} />}
<span>Rerun Prebuild ({prebuild.info.branch})</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Including the branch name in the dropdown action could be confusing as most of the times this will overflow and a truncated text will be presented.

Also, since the branch name is the key value in this page (first column field), if we need to repeat this value in the dropdown we may have to reconsider the design of this list layout. ❌

Screenshot 2021-09-30 at 4 04 34 PM

suggestion: What do you think of removing the branch name reference from this dropdown action. We could keep the title attribute if you think it helps. ❓

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point, thanks! Would it be cool to:

  • Make the dropdown items larger?
  • Add a title attribute or tooltip with the full text?

Comment on lines +156 to +157
{(!!project && prebuilds.length === 0) &&
<button onClick={() => triggerPrebuild(null)} className="ml-2">Run Prebuild</button>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: There's already an issue for adding a minimal empty state for this page in #5022. Ideally, in future iteration a better empty state with an illustration, title, and description would be great.

{(prebuild?.status === 'aborted' || prebuild?.status === 'timeout' || !!prebuild?.error)
? <button className="flex items-center space-x-2" disabled={isRerunningPrebuild} onClick={rerunPrebuild}>
{isRerunningPrebuild && <img className="h-4 w-4 animate-spin filter brightness-150" src={Spinner} />}
<span>Rerun Prebuild ({prebuild.info.branch})</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This fails to trigger any prebuild when there's a configuration error:

Error: Request triggerPrebuild failed with message: Invalid gitpod.yml: should be object

question: Ideally, this could trigger a new failed prebuild, right?

thought: Once we add the toast component (#3530) we could surface such errors with a toast notification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh 😳 I guess you're seeing this error in the console? Could you please provide more details on how you achieved this situation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jankeromnes yes, this is in console.

Steps to reproduce:

  1. Add a project with an invalid .gitpod.yml like https://github.com/issue-reproduce/configuration-error.
  2. Trigger a prebuild for any branch of that project

@@ -159,7 +153,8 @@ export default function () {
<div className="py-3 pl-3">
<DropDown prefix="Prebuild Status: " contextMenuWidth="w-32" entries={statusFilterEntries()} />
</div>
<button disabled={!project} onClick={() => triggerPrebuild(null)} className="ml-2">Trigger Prebuild</button>
{(!!project && prebuilds.length === 0) &&
<button onClick={() => triggerPrebuild(null)} className="ml-2">Run Prebuild</button>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The appearing and disappearing button feels a bit flaky, no?

Flaky appearing button ⬇️

Untitled2.mov

Flaky disappearing button ⬇️

Untitled3.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is flaky. 😞

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@@ -159,7 +153,8 @@ export default function () {
<div className="py-3 pl-3">
<DropDown prefix="Prebuild Status: " contextMenuWidth="w-32" entries={statusFilterEntries()} />
</div>
<button disabled={!project} onClick={() => triggerPrebuild(null)} className="ml-2">Trigger Prebuild</button>
{(!!project && prebuilds.length === 0) &&
<button onClick={() => triggerPrebuild(null)} className="ml-2">Run Prebuild</button>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Also, although I think the run prebuild being always visible is the best approach long term (see #5374 (comment)), instead of hiding this button and causing any confusion should we aim for addign a boring (simple) empty state like the one we have in workspaces for teams with no projects?

Workspaces list for teams with no projects
Screenshot 2021-09-30 at 6 08 58 PM (2)

Copy link
Contributor Author

@jankeromnes jankeromnes Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current state of the Run Prebuild button:

  • It requests a new Prebuild for a specific branch (by default, the default branch, but we could make the button branch-specific, or ask with a modal)
  • If there is already a successful Prebuild for the requested branch, the backend returns "a successful Prebuild already exists for this branch!" (but we don't show anything in the UI for that case)
  • If there is a Prebuild for the requested branch, but it has failed, then the backend will actually trigger a new Prebuild to "try again" (this is new with this PR -- previously it would just say "there is already a (failed) Prebuild for this branch, doing nothing!")

Are you proposing to always allow triggering new Prebuilds? I.e.

  • Even if there is a successful Prebuild for a branch (i.e. all the prebuilding work for the latest commit has already been done, and the result is ready to go) we force the creation of a new Prebuild for the same commit?

I don't see the value of this latter change (apart from making our button always enabled) even though it adds a bit more complexity to the backend (i.e. allow forcing the creation of new Prebuilds even if there is already a successful one)

@roboquat
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2c29e244a1683b632b6dc82c9f58d626f326a0e9

@roboquat
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: gtsiolis

Associated issue: #5771

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Sep 30, 2021

Many thanks for the review @gtsiolis! 💯

I think a lot of the confusion we have in many Teams & Projects pages stems from the fact that we never actually re-trigger a Prebuild. Instead, we trigger a new Prebuild for a branch.

This means that the Rerun Prebuild action on a specific Prebuild makes no sense. As a first improvement, I've tried to add the explicit branch name in every re-trigger action/button, in order to teach users that they actually trigger a new Prebuild for a specific branch (independently of any specific Prebuild -- you cannot re-trigger one Prebuild in particular).

Eventually, I think this option should only exist for Branches (e.g. Project > Branch > Run Prebuild). That's why I'm really looking forward to #5791 removing the current (all) Prebuilds page with its confusing Run Prebuild button, and replace it with a Prebuilds of branch 'X' page with a precise Run Prebuild button that makes sense.

I'll now fix the merge conflict and address all feedback, in order to get this in rather soon and then iterate on follow-ups. 🙂

@jankeromnes jankeromnes force-pushed the jx/allow-retriggering-prebuilds branch from fcfbe64 to 4d954d3 Compare September 30, 2021 15:41
@roboquat roboquat removed the lgtm label Sep 30, 2021
@roboquat
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@gtsiolis
Copy link
Contributor

gtsiolis commented Sep 30, 2021

I think a lot of the confusion we have in many Teams & Projects pages stems from the fact that we never actually re-trigger a Prebuild. Instead, we trigger a new Prebuild for a branch.

Agree! This is still confusing for me sometimes.

That's why I'm really looking forward to #5791 ...

Agree! 💯

I'll now fix the merge conflict and address all feedback, in order to get this in rather soon and then iterate on follow-ups.

@jankeromnes DEAL 🤝

@gtsiolis
Copy link
Contributor

/meow

@roboquat
Copy link
Contributor

@gtsiolis: cat image

In response to this:

/meow

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@AlexTugarev
Copy link
Member

@jankeromnes can this be merged?

We've seen other issues related to preparing/building status of prebuilds/pods, so I'd like to have this on master before going deeper and checking on staging.

@jankeromnes
Copy link
Contributor Author

jankeromnes commented Oct 1, 2021

@AlexTugarev Sure! We can merge. Most things can be done as follow-ups.

I'm just very unclear on what to do with the infamous Run Prebuild button in the Prebuilds page (every time I try to fix it, I feel like giving up and closing the PR again 🙄).

I'm not sure the current "flakily disappearing button" is actually better than the previous "mostly not-working button", but maybe this can also be improved as a follow-up? 🤷‍♂️

@jankeromnes
Copy link
Contributor Author

Carrying over the LGTM, since I've just rebased the PR.

/hold cancel

@roboquat roboquat merged commit 5503c9b into main Oct 1, 2021
@roboquat roboquat deleted the jx/allow-retriggering-prebuilds branch October 1, 2021 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rerunning Prebuild does nothing No feedback when triggering prebuilds
4 participants