Persist download URL when adding FMAs via non-GitOps API, fix software versions on GitOps YAML generation (#30331)

Fixes #29618, #30282.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- 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/guides/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] Manual QA for all new/changed functionality
This commit is contained in:
Ian Littman
2025-06-26 14:29:23 -05:00
committed by GitHub
parent 57939c94ef
commit 9bee64bf2d
9 changed files with 29 additions and 35 deletions
+1 -5
View File
@@ -1122,10 +1122,6 @@ func (cmd *GenerateGitopsCommand) generateSoftware(filePath string, teamId uint,
packages := make([]map[string]interface{}, 0)
appStoreApps := make([]map[string]interface{}, 0)
for _, sw := range software {
versions := make([]string, len(sw.Versions))
for j, version := range sw.Versions {
versions[j] = version.Version
}
softwareSpec := make(map[string]interface{})
switch {
case sw.SoftwarePackage != nil:
@@ -1133,7 +1129,7 @@ func (cmd *GenerateGitopsCommand) generateSoftware(filePath string, teamId uint,
if sw.SoftwarePackage.Name != "" {
pkgName = fmt.Sprintf(" (%s)", sw.SoftwarePackage.Name)
}
comment := cmd.AddComment(filePath, fmt.Sprintf("%s%s version %s", sw.Name, pkgName, strings.Join(versions, ", ")))
comment := cmd.AddComment(filePath, fmt.Sprintf("%s%s version %s", sw.Name, pkgName, sw.SoftwarePackage.Version))
if sw.HashSHA256 == nil {
cmd.Messages.Notes = append(cmd.Messages.Notes, Note{
Filename: filePath,
+3 -16
View File
@@ -201,31 +201,18 @@ func (MockClient) ListSoftwareTitles(query string) ([]fleet.SoftwareTitleListRes
case "available_for_install=1&team_id=1":
return []fleet.SoftwareTitleListResult{
{
ID: 1,
Name: "My Software Package",
Versions: []fleet.SoftwareVersion{{
ID: 1,
Version: "1.0.0",
}, {
ID: 2,
Version: "2.0.0",
}},
ID: 1,
Name: "My Software Package",
HashSHA256: ptr.String("software-package-hash"),
SoftwarePackage: &fleet.SoftwarePackageOrApp{
Name: "my-software.pkg",
Platform: "darwin",
Version: "13.37",
},
},
{
ID: 2,
Name: "My App Store App",
Versions: []fleet.SoftwareVersion{{
ID: 3,
Version: "5.6.7",
}, {
ID: 4,
Version: "8.9.10",
}},
AppStoreApp: &fleet.SoftwarePackageOrApp{
AppStoreID: "com.example.team-software",
},
@@ -64,7 +64,7 @@ software:
- Label C
- Label D
packages:
- hash_sha256: software-package-hash # My Software Package (my-software.pkg) version 1.0.0, 2.0.0
- hash_sha256: software-package-hash # My Software Package (my-software.pkg) version 13.37
install_script:
path: ../lib/team-a/scripts/my-software-package-darwin-install
labels_include_any: