Rename setup_experience_platforms to singular comma-separated setup_experience_platform (#49245)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** #43667 # Summary Renames the unreleased GitOps field `setup_experience_platforms` to singular `setup_experience_platform`, accepting a comma-separated string of `darwin`/`linux` (rejecting the `macos` alias) to match the query/policy/label `platform` convention. # Checklist for submitter - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters. ## Testing - [ ] Added/updated automated tests - [ ] QA'd all new/changed functionality manually ## New Fleet configuration settings - [ ] 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) - [ ] Verified that the setting is cleared on the server if it is not supplied in a YAML file (or that it is documented as being optional) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * Updated software setup-experience platform configuration to use a single comma-separated `setup_experience_platform` value. * Platform values are normalized for casing and whitespace, deduplicated, and validated against supported platforms. * macOS setup selections now use the canonical `darwin` value; the `macos` alias is rejected. * GitOps-generated configurations now use the updated field name and platform format. * **Bug Fixes** * Improved validation messages for invalid setup-experience platform values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -2002,8 +2002,8 @@ func (cmd *GenerateGitopsCommand) generateSoftware(filePath string, teamID uint,
|
||||
|
||||
setupSoftwareBySoftwareTitle := make(map[uint]struct{})
|
||||
setupSoftwareByPlatformAndAppID := make(map[string]struct{})
|
||||
// Emitted as setup_experience_platforms so a UI-set non-native selection
|
||||
// round-trips through generate → apply unchanged.
|
||||
// Emitted as setup_experience_platform (comma-separated) so a UI-set
|
||||
// non-native selection round-trips through generate → apply unchanged.
|
||||
crossPlatformSelectionsByTitleID := make(map[uint][]string)
|
||||
|
||||
// Fill in InstallDuringSetup for software, as that information is only available
|
||||
@@ -2043,7 +2043,9 @@ func (cmd *GenerateGitopsCommand) generateSoftware(filePath string, teamID uint,
|
||||
if pkg.Platform == fleet.CanonicalPlatform(crossTarget) {
|
||||
continue
|
||||
}
|
||||
crossPlatformSelectionsByTitleID[t.ID] = append(crossPlatformSelectionsByTitleID[t.ID], crossTarget)
|
||||
// Emit the canonical platform token ("darwin", not "macos") to match
|
||||
// the query/policy/label `platform` convention.
|
||||
crossPlatformSelectionsByTitleID[t.ID] = append(crossPlatformSelectionsByTitleID[t.ID], fleet.CanonicalPlatform(crossTarget))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2353,7 +2355,7 @@ func (cmd *GenerateGitopsCommand) generateSoftware(filePath string, teamID uint,
|
||||
softwareSpec["setup_experience"] = true
|
||||
}
|
||||
if crosses, ok := crossPlatformSelectionsByTitleID[softwareTitle.ID]; ok && len(crosses) > 0 {
|
||||
softwareSpec["setup_experience_platforms"] = crosses
|
||||
softwareSpec["setup_experience_platform"] = strings.Join(crosses, ",")
|
||||
}
|
||||
} else {
|
||||
platformAndAppID := softwareTitle.AppStoreApp.VPPAppID.String()
|
||||
|
||||
Reference in New Issue
Block a user