fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.04k stars 422 forks source link

Add ability to cancel scripts #19581

Open glacieryc opened 4 months ago

glacieryc commented 4 months ago

Goal

User story
As an IT admin,
I want to cancel a script that hasn't finished running
so that I can run another script immediately.

Context

Changes

Product

Engineering

ℹ️  Please read this issue carefully and understand it. Pay special attention to UI wireframes, especially "dev notes".

QA

Risk assessment

Manual testing steps

  1. Step 1
  2. Step 2
  3. Step 3

Testing notes

Confirmation

  1. [ ] Engineer (@____): Added comment to user story confirming successful completion of QA.
  2. [ ] QA (@____): Added comment to user story confirming successful completion of QA.
noahtalerman commented 4 months ago

Thanks @glacieryc!

We'll decide whether to prioritize it at the upcoming feature fest on 2024-06-24.

After running this script, we needed to run another script immediately

What script did you want to run immediately?

Did the script that updates packages eventually finish?

rachaelshaw commented 3 months ago

Updated to use the user story template.

Original feature request from @glacieryc:

Our company is looking for a solution on how to get rid of accidental execution of scripts. For example, we recently encountered a situation where we ran a script that updates packages on a laptop. After running this script, we needed to run another script immediately, but because the update script was running at the moment, we could not run the other script.

Potential solutions:

  1. Add a button to cancel script execution
  2. Add the ability to execute scripts in parallel
rachaelshaw commented 3 months ago

@glacieryc this didn't get designed during the 3-week timeline, bringing this back to Feature Fest

noahtalerman commented 2 months ago

From @rachaelshaw is design review doc:

WIP (in scratchpad) Discuss: Activity: Any reason this would need to go in upcoming activity feed? (Maybe if script has started running and finished before it could be successfully cancelled?) TODO: CLI?

nonpunctual commented 1 month ago

Scripts uploaded to Fleet & have then been deleted from Fleet should not run on any host. Tracking for @noahtalerman - if you would like me to break this into a separate FR please let me know.

Conversation:

@noahtalerman do we cancel pending scripts when a script is deleted?

@georgekarrv Scripts are soft deleted so activities can still point to them ...

@roperzh ...any pending script will eventually be delivered no matter what (probably to aid "non saved" scripts)

@nonpunctual ...seems like something as intentional as a deletion of the uploaded file should match the admin's intention such that deleted scripts would not run.

@gillespi314
...the original implementation of scripts was for non-saved scripts IIRC. So when it was extended to saved scripts, the default fire-and-forget behavior was carried over.

@noahtalerman Thank you all!

My 2¢ here is that if an admin deletes their script they expect it not to run.

Agreed.

Related: https://github.com/fleetdm/fleet/issues/17180 https://github.com/fleetdm/fleet/issues/17837 https://github.com/fleetdm/fleet/issues/19583