fleet/cmd/fleetctl/testdata
Scott Gress fca1e1ab42
Add GitOps for policy labels (#27781)
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>
2025-04-04 09:46:51 -05:00
..
gitops Add GitOps for policy labels (#27781) 2025-04-04 09:46:51 -05:00
convert_input.conf Update fleetctl convert for schedulable queries (#13125) 2023-08-08 10:39:20 -07:00
convert_output.yml Add labels to queries using gitops (#27259) 2025-03-20 15:32:52 -05:00
expectedGetConfigAppConfigJson.json Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetConfigAppConfigTeamMaintainerJson.json Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetConfigAppConfigTeamMaintainerYaml.yml Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetConfigAppConfigYaml.yml Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetConfigIncludeServerConfigJson.json Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetConfigIncludeServerConfigYaml.yml Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
expectedGetTeamsJson.json SE: CLI setup experience changes (#22956) 2024-10-23 14:51:02 -04:00
expectedGetTeamsText.txt fleetctl get teams prints team id (#18395) 2024-04-29 09:56:04 -04:00
expectedGetTeamsYaml.yml Allow setting failing policy webhook for team via GitOps (#25715) 2025-01-30 11:21:43 -06:00
expectedHostDetailResponseJson.json don't rely on MDM solution name to know if the host has Fleet MDM on (#19688) 2024-06-14 15:01:12 -03:00
expectedHostDetailResponseYaml.yml don't rely on MDM solution name to know if the host has Fleet MDM on (#19688) 2024-06-14 15:01:12 -03:00
expectedListHostsJson.json don't rely on MDM solution name to know if the host has Fleet MDM on (#19688) 2024-06-14 15:01:12 -03:00
expectedListHostsMDM.json don't rely on MDM solution name to know if the host has Fleet MDM on (#19688) 2024-06-14 15:01:12 -03:00
expectedListHostsYaml.yml don't rely on MDM solution name to know if the host has Fleet MDM on (#19688) 2024-06-14 15:01:12 -03:00
macosSetupExpectedAppConfigEmpty.yml Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
macosSetupExpectedAppConfigSet.yml Add DigiCert configs. (#26780) 2025-03-05 15:02:26 -06:00
macosSetupExpectedTeam1And2Empty.yml Allow setting failing policy webhook for team via GitOps (#25715) 2025-01-30 11:21:43 -06:00
macosSetupExpectedTeam1And2Set.yml Allow setting failing policy webhook for team via GitOps (#25715) 2025-01-30 11:21:43 -06:00
macosSetupExpectedTeam1Empty.yml Allow setting failing policy webhook for team via GitOps (#25715) 2025-01-30 11:21:43 -06:00
macosSetupExpectedTeam1Set.yml Allow setting failing policy webhook for team via GitOps (#25715) 2025-01-30 11:21:43 -06:00