mirror of
https://github.com/fleetdm/fleet
synced 2026-05-17 22:18:39 +00:00
For #27301 # Checklist for submitter <!-- Note that API documentation changes are now addressed by the product design team. --> - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [X] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [X] Added/updated automated tests - [X] 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) - [X] Manual QA for all new/changed functionality # Details This PR adds the ability to set/unset labels on policies via GitOps. It builds on https://github.com/fleetdm/fleet/pull/27575 (back end for policy labels) and updates the `PolicySpec` type and `ApplyPolicySpecs` methods to update the `policy_labels` table where needed. ## Testing 1. Create a few labels in the UI 1. Create a global policy "foo" in the UI without labels 2. Create a global policy "bar" in the UI with labels 2. Create a global policy "baz" in the UI with labels 4. Use `fleetctl gitops` with a global .yml file, and under `policies:` add "foo", "bar", "baz" and "boop". * Add labels to "foo" with `labels_include_any:` * Don't add `labels_include_any:` to "bar" * Add labels to "baz" with `labels_include_any:`, but different labels than what you added in the UI * Add labels to "boop" with `labels_include_any:` The expected outcome when viewing the queries in the UI (on the "edit query" screen) * Foo, Baz and Boop should have the labels specified in gitops * Bar should have no labels Repeat testing with _excluded_ labels. --------- Co-authored-by: dantecatalfamo <dante.catalfamo@gmail.com> Co-authored-by: Dante Catalfamo <43040593+dantecatalfamo@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| testdata | ||
| api.go | ||
| api_test.go | ||
| apply.go | ||
| apply_test.go | ||
| config.go | ||
| config_test.go | ||
| convert.go | ||
| convert_test.go | ||
| debug.go | ||
| debug_test.go | ||
| delete.go | ||
| delete_test.go | ||
| flags.go | ||
| fleetctl.go | ||
| generate.go | ||
| generate_test.go | ||
| get.go | ||
| get_test.go | ||
| gitops.go | ||
| gitops_enterprise_integration_test.go | ||
| gitops_integration_test.go | ||
| gitops_test.go | ||
| goquery.go | ||
| hosts.go | ||
| hosts_test.go | ||
| kill_process.go | ||
| kill_process_windows.go | ||
| login.go | ||
| logout.go | ||
| logout_test.go | ||
| mdm.go | ||
| mdm_test.go | ||
| package.go | ||
| package_test.go | ||
| preview.go | ||
| preview_test.go | ||
| query.go | ||
| query_output.go | ||
| query_test.go | ||
| scripts.go | ||
| scripts_test.go | ||
| session_test.go | ||
| setup.go | ||
| testing_utils.go | ||
| trigger.go | ||
| trigger_test.go | ||
| upgrade_packs.go | ||
| upgrade_packs_test.go | ||
| user.go | ||
| users_test.go | ||
| vulnerability_data_stream.go | ||
| vulnerability_data_stream_test.go | ||