mirror of
https://github.com/fleetdm/fleet
synced 2026-04-29 01:17:35 +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> |
||
|---|---|---|
| .. | ||
| lib | ||
| subdir | ||
| global_config_no_paths.yml | ||
| global_config_no_paths_no_controls.yml | ||
| global_config_no_paths_no_labels.yml | ||
| global_config_windows_migration_false_false.yml | ||
| global_config_windows_migration_false_true.yml | ||
| global_config_windows_migration_true_false.yml | ||
| global_config_windows_migration_true_true.yml | ||
| global_integration.yml | ||
| global_macos_custom_settings_valid_deprecated.yml | ||
| global_macos_windows_custom_settings_valid.yml | ||
| global_windows_custom_settings_invalid_label_mix.yml | ||
| global_windows_custom_settings_invalid_label_mix_2.yml | ||
| global_windows_custom_settings_unknown_label.yml | ||
| no_team_setup_software_invalid_script.yml | ||
| no_team_setup_software_invalid_software_package.yml | ||
| no_team_setup_software_invalid_vpp_app.yml | ||
| no_team_setup_software_valid.yml | ||
| no_team_software_installer_install_not_found.yml | ||
| no_team_software_installer_invalid_both_include_exclude.yml | ||
| no_team_software_installer_invalid_self_service_value.yml | ||
| no_team_software_installer_invalid_unknown_label.yml | ||
| no_team_software_installer_no_url.yml | ||
| no_team_software_installer_not_found.yml | ||
| no_team_software_installer_post_install_not_found.yml | ||
| no_team_software_installer_pre_condition_multiple_queries.yml | ||
| no_team_software_installer_pre_condition_not_found.yml | ||
| no_team_software_installer_subdir.yml | ||
| no_team_software_installer_too_large.yml | ||
| no_team_software_installer_uninstall_not_found.yml | ||
| no_team_software_installer_unsupported.yml | ||
| no_team_software_installer_valid.yml | ||
| no_team_software_installer_valid_exclude.yml | ||
| no_team_software_installer_valid_include.yml | ||
| team_config_no_paths.yml | ||
| team_config_webhook.yml | ||
| team_macos_custom_settings_valid_deprecated.yml | ||
| team_macos_windows_custom_settings_invalid_labels_mix.yml | ||
| team_macos_windows_custom_settings_invalid_labels_mix_2.yml | ||
| team_macos_windows_custom_settings_unknown_label.yml | ||
| team_macos_windows_custom_settings_valid.yml | ||
| team_setup_software_invalid_script.yml | ||
| team_setup_software_invalid_software_package.yml | ||
| team_setup_software_invalid_vpp_app.yml | ||
| team_setup_software_valid.yml | ||
| team_software_installer_install_not_found.yml | ||
| team_software_installer_invalid_both_include_exclude.yml | ||
| team_software_installer_invalid_self_service_value.yml | ||
| team_software_installer_invalid_unknown_label.yml | ||
| team_software_installer_no_url.yml | ||
| team_software_installer_not_found.yml | ||
| team_software_installer_post_install_not_found.yml | ||
| team_software_installer_pre_condition_multiple_queries.yml | ||
| team_software_installer_pre_condition_multiple_queries_apply.yml | ||
| team_software_installer_pre_condition_not_found.yml | ||
| team_software_installer_subdir.yml | ||
| team_software_installer_too_large.yml | ||
| team_software_installer_uninstall_not_found.yml | ||
| team_software_installer_unsupported.yml | ||
| team_software_installer_valid.yml | ||
| team_software_installer_valid_apply.yml | ||
| team_software_installer_valid_env_query.yml | ||
| team_software_installer_valid_exclude.yml | ||
| team_software_installer_valid_include.yml | ||
| team_vpp_empty_adamid.yml | ||
| team_vpp_incorrect_type.yml | ||
| team_vpp_invalid_app.yml | ||
| team_vpp_invalid_app_labels_both.yml | ||
| team_vpp_invalid_app_labels_exclude_any.yml | ||
| team_vpp_invalid_app_labels_include_any.yml | ||
| team_vpp_valid_app.yml | ||
| team_vpp_valid_app_labels_exclude_any.yml | ||
| team_vpp_valid_app_labels_include_any.yml | ||
| team_vpp_valid_app_self_service.yml | ||
| team_vpp_valid_empty.yml | ||