[YAML] Patch policies: Install new version when app is closed - #49022
Merged
Conversation
Documents the proposed only_when_closed key on Fleet-maintained-app patch policies, for design review ahead of implementation.
marko-lisica
marked this pull request as draft
July 9, 2026 13:09
marko-lisica
commented
Jul 10, 2026
| type: patch | ||
| fleet_maintained_app_slug: zoom/darwin | ||
| continuous_automations_enabled: true | ||
| only_when_closed: true # default; update is skipped (and retried later) while Zoom is open |
Member
Author
There was a problem hiding this comment.
Suggested change
| only_when_closed: true # default; update is skipped (and retried later) while Zoom is open | |
| patch_only_when_closed: true # default; update is skipped (and retried later) while Zoom is open |
marko-lisica
commented
Jul 10, 2026
marko-lisica
commented
Jul 10, 2026
58 tasks
This was referenced Jul 16, 2026
marko-lisica
marked this pull request as ready for review
July 17, 2026 11:35
rachaelshaw
reviewed
Jul 20, 2026
| To automatically install the app when this policy fails, you can add an automation by setting `install_software` to `true`. | ||
| To automatically patch the app when this policy fails, whether or not the app is open, set `install_software` to `true`. | ||
|
|
||
| To automatically patch the app when this policy fails and app is not open, set `patch_when_closed` to `true`. With this option Fleet adds a read-only pre-install query that skips automatic install while the app is open and retries on the next policy run, and it doesn't retry 2 more times. Also, the `continuous_automations_enabled` is automatically set to `true`. |
Member
There was a problem hiding this comment.
Might make sense to clarify what happens after those retries hit the maximum. (Does it install even though the app is open, or not install?)
rachaelshaw
requested changes
Jul 20, 2026
rachaelshaw
left a comment
Member
There was a problem hiding this comment.
Left one note about a clarification we may want to add
marko-lisica
commented
Jul 22, 2026
Co-authored-by: Marko Lisica <83164494+marko-lisica@users.noreply.github.com>
fleet-release
approved these changes
Jul 22, 2026
rachaelshaw
approved these changes
Jul 22, 2026
6 tasks
cdcme
added a commit
that referenced
this pull request
Jul 28, 2026
**Related issue:** Resolves #49418 Adds `patch_when_closed` support to GitOps for patch policies and round-trips it through `fleetctl generate-gitops`. - Validate `patch_when_closed` in the patch-policy YAML: reject an explicit `continuous_automations_enabled: false` alongside it (GitOps is declarative — the datastore would otherwise silently force it on), auto-set it when omitted, and reject a `pre_install_query` on the referenced Fleet-maintained app (Fleet manages that query). - Emit `patch_when_closed` from `fleetctl generate-gitops`. # Checklist for submitter - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters. ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually ## New Fleet configuration settings Follow this checklist for GitOps-enabled settings: - [x] Verified that the setting is exported via `fleetctl generate-gitops` - [x] Verified the setting is documented in a separate PR to [the GitOps documentation](https://github.com/fleetdm/fleet/blob/main/docs/Configuration/yaml-files.md) (#49022) - [x] Verified that the setting is cleared on the server if it is not supplied in a YAML file --------- Co-authored-by: Jonathan Katz <yehonatankatz@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to: