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

Remove default EXE install/uninstall scripts, require entering install/uninstall scripts on EXE upload #27268

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

iansltx
Copy link
Member

@iansltx iansltx commented Mar 19, 2025

For #27267.

Below is what's shown immediately after selecting an EXE:

image

TODO:

  • Tests
  • GitOps requirements changes
  • Disabling add button/adding errors when required scripts aren't specified

Checklist for submitter

If some of the following don't apply, delete the relevant line.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated automated tests
  • A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it)
  • Manual QA for all new/changed functionality

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 68.75000% with 10 lines in your changes missing coverage. Please review.

Project coverage is 63.72%. Comparing base (c591880) to head (7af4345).
Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
ee/server/service/software_installers.go 50.00% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #27268      +/-   ##
==========================================
- Coverage   63.72%   63.72%   -0.01%     
==========================================
  Files        1747     1748       +1     
  Lines      165935   166129     +194     
  Branches     4518     4583      +65     
==========================================
+ Hits       105748   105866     +118     
- Misses      51924    51987      +63     
- Partials     8263     8276      +13     
Flag Coverage Δ
backend 64.54% <68.75%> (-0.01%) ⬇️
frontend 54.12% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines 37 to 45
Use the $INSTALLER_PATH variable to point to the installer.{" "}
{getSupportedScriptTypeText(pkgType)}.{" "}
<CustomLink
url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="EXE install scripts must be built manually."
newTab
/>{" "}
Fleet can automatically build install and uninstall scripts for MSI
packages and Fleet-maintained Apps.
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 73 to 83
return (
<>
$PACKAGE_ID will be populated with the {PKG_TYPE_TO_ID_TEXT[pkgType]}{" "}
from the .{pkgType} file after the software is added.{" "}
{getSupportedScriptTypeText(pkgType)}{" "}
<CustomLink
url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="EXE uninstall scripts must be built manually."
newTab
/>{" "}
Fleet can automatically build install and uninstall scripts for MSI
packages and Fleet-maintained Apps.
</>
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 75 to 84
$PACKAGE_ID will be populated with the {PKG_TYPE_TO_ID_TEXT[pkgType]}{" "}
from the .{pkgType} file after the software is added.{" "}
{getSupportedScriptTypeText(pkgType)}{" "}
<CustomLink
url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="EXE uninstall scripts must be built manually."
newTab
/>{" "}
Fleet can automatically build install and uninstall scripts for MSI
packages and Fleet-maintained Apps.
Copy link
Member

@noahtalerman noahtalerman Mar 19, 2025

Choose a reason for hiding this comment

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

Suggested change
$PACKAGE_ID will be populated with the {PKG_TYPE_TO_ID_TEXT[pkgType]}{" "}
from the .{pkgType} file after the software is added.{" "}
{getSupportedScriptTypeText(pkgType)}{" "}
<CustomLink
url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="EXE uninstall scripts must be built manually."
newTab
/>{" "}
Fleet can automatically build install and uninstall scripts for MSI
packages and Fleet-maintained Apps.
For Windows, Fleet only creates uninstall scripts for .msi packages. $PACKAGE_ID will be populated with the software name from the .exe file after it's added.
{getSupportedScriptTypeText(pkgType)}{" "}
<CustomLink
url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="Learn more"
newTab
/>

return (
<>
For Windows, Fleet only creates install scripts for .msi packages. Use the $INSTALLER_PATH variable to point to the installer. {" "}
{getSupportedScriptTypeText(pkgType)}.{" "}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{getSupportedScriptTypeText(pkgType)}.{" "}
{getSupportedScriptTypeText(pkgType)}{" "}

Copy link
Member

Choose a reason for hiding this comment

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

I think this may result in a double period.

url={`${LEARN_MORE_ABOUT_BASE_LINK}/exe-install-scripts`}
text="Learn more"
newTab
/>{" "}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/>{" "}
/>

We don't need this right?

Copy link
Member

Choose a reason for hiding this comment

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

This inserts a space, so not unless there's text after it.

@@ -389,6 +392,9 @@ func (svc *Service) UpdateSoftwareInstaller(ctx context.Context, payload *fleet.
if uninstallScript == "" { // extension can't change on an edit so we can generate off of the existing file
uninstallScript = file.GetUninstallScript(existingInstaller.Extension)
}
if uninstallScript == "" {
return nil, ctxerr.New(ctx, fmt.Sprintf("uninstall script must be provided for %s packages", strings.ToUpper(existingInstaller.Extension)))
Copy link
Member

Choose a reason for hiding this comment

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

@iansltx I think we want the "Couldn't add. Install script is required for .exe packages":

Screenshot 2025-03-19 at 11 31 45 AM

Same tweak for uninstall error.

@RachelElysia
Copy link
Member

@iansltx jumping on finishing this now

@RachelElysia
Copy link
Member

Since the form originally has the Add software button disabled, I added validation to keep it disabled if .exe file was chosen but install and uninstall scripts are not filled out. See screenshots below.

WDYT? @iansltx @noahtalerman

Screenshot 2025-03-20 at 3 54 47 PM Screenshot 2025-03-20 at 3 54 35 PM Screenshot 2025-03-20 at 3 54 11 PM

@iansltx
Copy link
Member Author

iansltx commented Mar 20, 2025

Deferring to @noahtalerman on copy here, but the behavior LGTM! Nice and clear, and keeps folks from doing something that we know will fail server-side.

iansltx and others added 11 commits March 28, 2025 09:36
…l/uninstall scripts on EXE upload

For #27267.

TODO:

* Tests
* GitOps requirements changes
* Disabling add button/adding errors when required scripts aren't specified
…PackageAdvancedOptions.tsx

Co-authored-by: Noah Talerman <47070608+noahtalerman@users.noreply.github.com>
Still need to fix the integration test
@iansltx iansltx force-pushed the 27267-drop-exe-install-scripts branch from 1282182 to 20d860b Compare March 28, 2025 15:01
…s with parse errors when validating YAML

If the URL path doesn't end with .exe, we'll still catch EXEs later in the process when the package is downloaded by Fleet, but for easier cases we might as well fail early.
@iansltx iansltx marked this pull request as ready for review March 29, 2025 23:13
@iansltx iansltx requested review from a team as code owners March 29, 2025 23:13
@iansltx iansltx assigned iansltx, ksykulev and ghernandez345 and unassigned iansltx Mar 29, 2025
@iansltx
Copy link
Member Author

iansltx commented Mar 29, 2025

@ghernandez345 Assigning you here since Rachel and I have both touched this on the FE side so this should get a separate set of eyes.

@ksykulev Your review responsibilities are backend + gitops + associated tests only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants