Skip to content

Allow "unassigned.yml" in GitOps#40414

Merged
sgress454 merged 11 commits intomainfrom
sgress454/update-gitops-to-support-unassigned.yml
Feb 26, 2026
Merged

Allow "unassigned.yml" in GitOps#40414
sgress454 merged 11 commits intomainfrom
sgress454/update-gitops-to-support-unassigned.yml

Conversation

@sgress454
Copy link
Copy Markdown
Contributor

@sgress454 sgress454 commented Feb 24, 2026

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.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually
    From test plan:
  • 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.
  • Do the above without --dry-run and verify via the UI and/or fleetctl generate-gitops that the Fleet config is as expected.
  • 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
  • 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.
  • Do the same as the above without --dry-run and verify that the Fleet config is as expected.
  • 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

@sgress454 sgress454 marked this pull request as ready for review February 24, 2026 20:08
@sgress454 sgress454 requested a review from a team as a code owner February 24, 2026 20:08
@sgress454 sgress454 assigned iansltx and unassigned iansltx Feb 24, 2026
@sgress454 sgress454 added this to the 4.82.0 milestone Feb 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 85.48387% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.30%. Comparing base (55e20da) to head (cc5ab97).
⚠️ Report is 89 commits behind head on main.

Files with missing lines Patch % Lines
cmd/fleetctl/fleetctl/generate_gitops.go 54.54% 5 Missing ⚠️
cmd/fleetctl/fleetctl/gitops.go 90.00% 1 Missing and 1 partial ⚠️
ee/server/service/software_installers.go 0.00% 1 Missing ⚠️
pkg/spec/gitops.go 96.66% 1 Missing ⚠️
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     
Flag Coverage Δ
backend 68.17% <85.48%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread cmd/fleetctl/fleetctl/gitops.go
Comment thread pkg/spec/gitops.go
Comment thread changes/40433-deprecate-no-team-yml Outdated
Comment thread cmd/fleetctl/fleetctl/gitops_test.go Outdated
Comment thread pkg/spec/gitops.go Outdated
Comment on lines +342 to +348
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))
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these should be switch cases above the IsNoTeam || IsUnAssignedTeam checks, returning after appending the errors, rather than falling through.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, will update

Comment thread pkg/spec/gitops.go Outdated
Comment on lines +419 to +421
func isUnassignedTeam(teamName string) bool {
return strings.EqualFold(teamName, unassignedTeamName)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i was just following a pattern but it's a silly pattern, will fix

Comment thread pkg/spec/gitops.go Outdated
Comment thread pkg/spec/gitops_test.go Outdated
Co-authored-by: Ian Littman <iansltx@gmail.com>
iansltx
iansltx previously approved these changes Feb 26, 2026
@sgress454 sgress454 merged commit 10c997b into main Feb 26, 2026
51 checks passed
@sgress454 sgress454 deleted the sgress454/update-gitops-to-support-unassigned.yml branch February 26, 2026 13:47
sgress454 added a commit that referenced this pull request Feb 26, 2026
<!-- 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>
sgress454 added a commit that referenced this pull request Feb 26, 2026
Cherry-pick of #40414 into `rc-minor-fleet-v4.82.0`.

Co-authored-by: Ian Littman <iansltx@gmail.com>
@georgekarrv georgekarrv mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants