fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Increase character limit for saved scripts

Open noahtalerman opened this issue 1 year ago • 3 comments

Goal

User story
As an IT admin,
I want to run the Installomator.sh script (~390k characters)
so that I can install software on hosts using scripts w/o having to call Installomator.sh w/ another script.

Changes

Product

  • [ ] UI changes: Figma link
  • [ ] CLI usage changes: Figma link for CLI
  • [ ] REST API changes: PR link
    • Update script character limit to 500,000k for saved scripts
    • For both POST /scripts/run/sync POST /scripts/run return an error if script_contents is specified and the script is over 10k characters. Error message:
      • Error: Script is too large. 'script_content' is limited to 10,000 characters. To run larger script save it to Fleet and use 'script_name' parameter.

Engineering

  • [ ] Database schema migrations: TODO
  • [ ] Load testing: TODO

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

Context

  • Requestor(s): _________________________

QA

Risk assessment

  • Requires load testing: TODO
  • Risk level: Low / High TODO
  • Risk description: TODO

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 avatar Feb 08 '24 14:02 noahtalerman

More context:

From @dherder: customer is looking for a way to execute a script that has more than 10,000 characters.

From @pacamaster: 302847250-a174358b-877f-45c9-a5f5-94182b37dae1

Other customers are trying to use installomator

  • installomator is an 8500 line, 390k character, 380kb bash script that executes in a single pass each time it's called.
  • because Fleet does not yet include its own application install features, for orgs that are allowed to use installomator, it's critical
  • my personal script repo (mostly written for Jamf) average number of lines is around 200. This is partly because scripts contain boilerplate code for logging & perhaps for API authentication, or here docs or base64 encoded graphics or, etc.

What are you doing right now to work around this issue?

Calling scripts with other scripts but this is unnecessarily complex & can cause many issues with execution including:

  • inaccurate feedback / logs
  • weird subshell / permissions behavior

Fleet should allow admins to run ANY script.

noahtalerman avatar Feb 08 '24 14:02 noahtalerman

Hey @harrisonravazzolo, @nonpunctual told me that you're excited about this improvement.

Heads up that it's in the current sprint (target release date is 2024-03-11).

noahtalerman avatar Feb 20 '24 22:02 noahtalerman

Here is another script that macOS admins will probably want to deploy: https://github.com/grahampugh/erase-install/releases/tag/v33.0

nonpunctual avatar Mar 03 '24 01:03 nonpunctual

Validated error state for exceeding character count in UI and CLI:

Error: Script is too large. Script referenced by '--script-path' is limited to 10,000 characters. To run larger script save it to Fleet and use '--script-name'.

Screenshot 2024-03-05 at 4.36.58 PM.png

Validated new help menu text:

bri@Bris-MBP-2 fleet % ./build/fleetctl run-script --help
NAME:
   fleetctl run-script - Run a live script on one host and get results back (5 minute timeout).

USAGE:
   fleetctl run-script [options]

OPTIONS:
   --script-path value  The path to the script.
   --host value         A host, specified by hostname, serial number, UUID, osquery host ID, or node key.
   --script-name value  Name of saved script to run.
   --team value         Available in Fleet Premium. ID of the team that the saved script belongs to. 0 targets hosts assigned to “No team” (default: 0). (default: 0)
   --config value       Path to the fleetctl config file (default: "/Users/bri/.fleet/config") [$CONFIG]
   --context value      Name of fleetctl config context to use (default: "default") [$CONTEXT]
   --debug              Enable debug http request logging (default: false) [$DEBUG]
   --help, -h           show help (default: false)

Validated net-new functionality of running saved scripts from the CLI.

No regressions observed in existing scripts functionality.

sabrinabuckets avatar Mar 05 '24 22:03 sabrinabuckets

Docs PR is here: #16699

Still need to merge it in.

@Patagonia121 heads up, this customer requests was shipped in fleet 4.47 🎸

noahtalerman avatar Mar 15 '24 16:03 noahtalerman

Long scripts unfurl, Cloud city's tech pulse quickens, Ease for admins reigns.

fleet-release avatar Mar 21 '24 18:03 fleet-release