Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #40414 +/- ##
==========================================
+ Coverage 66.27% 66.30% +0.02%
==========================================
Files 2459 2465 +6
Lines 197172 197448 +276
Branches 8715 8715
==========================================
+ Hits 130677 130916 +239
- Misses 54668 54685 +17
- Partials 11827 11847 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if result.IsNoTeam() && filepath.Base(filePath) != "no-team.yml" { | ||
| multiError = multierror.Append(multiError, fmt.Errorf("file %q for No Team must be named 'no-team.yml'", filePath)) | ||
| multiError = multierror.Append(multiError, errors.New("no-team.yml is deprecated; please rename the file to 'unassigned.yml' and update the team name to 'Unassigned'.")) | ||
| } | ||
| if result.IsUnassignedTeam() && filepath.Base(filePath) != "unassigned.yml" { | ||
| multiError = multierror.Append(multiError, fmt.Errorf("file %q for unassigned hosts must be named 'unassigned.yml'", filePath)) | ||
| } |
There was a problem hiding this comment.
Seems like these should be switch cases above the IsNoTeam || IsUnAssignedTeam checks, returning after appending the errors, rather than falling through.
There was a problem hiding this comment.
good call, will update
| func isUnassignedTeam(teamName string) bool { | ||
| return strings.EqualFold(teamName, unassignedTeamName) | ||
| } |
There was a problem hiding this comment.
This, and the comparable isNoTeam, should be folded into the *GitOps method rather than split out, given that it's a one-liner that's used in exactly one place.
There was a problem hiding this comment.
yeah i was just following a pattern but it's a silly pattern, will fix
Co-authored-by: Ian Littman <iansltx@gmail.com>
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** For #40433 # Details This PR updates `fleetctl gitops` and `fleetctl generate_gitops` to use `unassigned.yml` in place of `no-team.yml`. The two files are utilized identically, except that `unassigned.yml` expects the `name:` to be `Unassigned` rather than `No team`. Internally, we still map some things to the string "no team" before sending to the back end so that we don't have to update back-end code and make more spaghetti to clean up when we 🔪 No Team as a concept in Fleet 5. We do pass the filename into the main `DoGitOps` method, but both I and Claude did our best to determine that it's not used in any way that would break with this change. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [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/guides/committing-changes.md#changes-files) for more information. ## Testing - [X] Added/updated automated tests - [X] QA'd all new/changed functionality manually From test plan: - [X] With a pre-existing GitOps folder w/ `no-team.yml`, run `fleetctl gitops -f /path/to/no-team.yml --dry-run --enable-log-topics=deprecated-field-names` and verify that everything works as expected and you get the deprecation warning. - [X] Do the above without `--dry-run` and verify via the UI and/or `fleetctl generate-gitops` that the Fleet config is as expected. - [X] Change `no-team.yml` to `unassigned.yml`, try a gitops run with `fleetctl gitops -f /path/to/unassigned.yml --dry-run --enable-log-topics=deprecated-field-names` and verify that you get an error because the `name:` is still `No team` - [X] Change the `name:` to `Unassigned`, repeat the run above and verify that the output is the same as with `no-team.yml`, and that no deprecation warning is listed. - [X] Do the same as the above without `--dry-run` and verify that the Fleet config is as expected. - [X] Run `fleetctl generate-gitops` and verify that `unassigned.yml` is output rather than `no-team.yml`, and any related files are under the `lib/unassigned` folder rather than `lib/no-team`, and any paths inside `unassigned.yml` (e.g. for scripts) are pointed at `lib/unassigned`. ## New Fleet configuration settings - [X] Verified that the setting is exported via `fleetctl generate-gitops` - [ ] 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#L485) @noahtalerman will work on this --------- Co-authored-by: Ian Littman <iansltx@gmail.com>
Cherry-pick of #40414 into `rc-minor-fleet-v4.82.0`. Co-authored-by: Ian Littman <iansltx@gmail.com>
Related issue: For #40433
Details
This PR updates
fleetctl gitopsandfleetctl generate_gitopsto useunassigned.ymlin place ofno-team.yml. The two files are utilized identically, except thatunassigned.ymlexpects thename:to beUnassignedrather thanNo team.Internally, we still map some things to the string "no team" before sending to the back end so that we don't have to update back-end code and make more spaghetti to clean up when we 🔪 No Team as a concept in Fleet 5.
We do pass the filename into the main
DoGitOpsmethod, but both I and Claude did our best to determine that it's not used in any way that would break with this change.Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
From test plan:
no-team.yml, runfleetctl gitops -f /path/to/no-team.yml --dry-run --enable-log-topics=deprecated-field-namesand verify that everything works as expected and you get the deprecation warning.--dry-runand verify via the UI and/orfleetctl generate-gitopsthat the Fleet config is as expected.no-team.ymltounassigned.yml, try a gitops run withfleetctl gitops -f /path/to/unassigned.yml --dry-run --enable-log-topics=deprecated-field-namesand verify that you get an error because thename:is stillNo teamname:toUnassigned, repeat the run above and verify that the output is the same as withno-team.yml, and that no deprecation warning is listed.--dry-runand verify that the Fleet config is as expected.fleetctl generate-gitopsand verify thatunassigned.ymlis output rather thanno-team.yml, and any related files are under thelib/unassignedfolder rather thanlib/no-team, and any paths insideunassigned.yml(e.g. for scripts) are pointed atlib/unassigned.New Fleet configuration settings
fleetctl generate-gitops@noahtalerman will work on this