Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CLI and endpoints to set software via fleetctl apply #18876

Merged
merged 19 commits into from
May 14, 2024

Conversation

roperzh
Copy link
Member

@roperzh roperzh commented May 9, 2024

for #18325

Checklist for submitter

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

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated tests
  • Manual QA for all new/changed functionality

@roperzh roperzh marked this pull request as ready for review May 13, 2024 13:02
@roperzh roperzh requested a review from a team as a code owner May 13, 2024 13:02
Copy link
Member

@mna mna left a comment

Choose a reason for hiding this comment

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

Awesome! Left some minor nits but overall LGTM, just worried a bit about all that happens on every gitops apply but I think that's something we already discussed on addressing in a future iteration.

ee/server/service/software_installers.go Outdated Show resolved Hide resolved
}

g, workerCtx := errgroup.WithContext(ctx)
g.SetLimit(3)
Copy link
Member

Choose a reason for hiding this comment

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

ee/server/service/software_installers.go Outdated Show resolved Hide resolved
ee/server/service/software_installers.go Show resolved Hide resolved
case "msi":
name, version, shaSum, err = ExtractMSIMetadata(br)
default:
return "", "", "", nil, ErrUnsupportedType
Copy link
Member

Choose a reason for hiding this comment

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

🎉

pkg/fleethttp/fleethttp.go Outdated Show resolved Hide resolved
pkg/fleethttp/fleethttp.go Show resolved Hide resolved
server/datastore/mysql/software_installers.go Show resolved Hide resolved
@@ -559,6 +559,65 @@ func (c *Client) ApplyGroup(
tmScriptsPayloads[k] = scriptPayloads
}

tmSoftware := extractTmSpecsSoftware(specs.Teams)
Copy link
Member

Choose a reason for hiding this comment

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

Just for my understanding, this adds the support for both fleetctl apply and fleetctl gitops? They both end up calling this ApplyGroup?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks so much for this comment. I will upload the title of the issue to note that this is only for fleetctl apply. I might need to adjust gitops in a follow up because at first glance it's going to be a significant diff as well :(

Copy link
Member

Choose a reason for hiding this comment

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

Argh :( I thought this was good for both. Let coordinate in slack if there are ways to split work for all the remaining bits.

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good, thank you!!

Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
@roperzh roperzh changed the title add CLI and endpoints to set software via gitops add CLI and endpoints to set software via fleetctl apply May 14, 2024
server/fleet/teams.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 58.48671% with 203 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (feat-software-installers@3579e5a). Click here to learn what that means.

❗ Current head 1a70dd4 differs from pull request most recent head a79a616. Consider uploading reports for the commit a79a616 to get more accurate results

Files Patch % Lines
ee/server/service/software_installers.go 47.59% 64 Missing and 23 partials ⚠️
server/service/client.go 39.47% 43 Missing and 3 partials ⚠️
pkg/file/file.go 50.84% 26 Missing and 3 partials ⚠️
server/datastore/mysql/software_installers.go 83.06% 14 Missing and 7 partials ⚠️
pkg/fleethttp/fleethttp.go 58.82% 5 Missing and 2 partials ⚠️
server/service/software_installers.go 57.14% 6 Missing ⚠️
server/fleet/software_installer.go 50.00% 3 Missing ⚠️
server/service/client_teams.go 62.50% 2 Missing and 1 partial ⚠️
server/service/client_mdm.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##             feat-software-installers   #18876   +/-   ##
===========================================================
  Coverage                            ?   66.71%           
===========================================================
  Files                               ?      898           
  Lines                               ?   110937           
  Branches                            ?        0           
===========================================================
  Hits                                ?    74015           
  Misses                              ?    30912           
  Partials                            ?     6010           
Flag Coverage Δ
backend 66.71% <58.48%> (?)

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.

@mna
Copy link
Member

mna commented May 14, 2024

@roperzh I'll let you merge this before I merge #18982, as it's more urgent and my PR could introduce some conflicts.

@mna
Copy link
Member

mna commented May 14, 2024

@roperzh CI failure is unrelated (--- FAIL: TestVulnerabilityDataStream), feel free to merge!

@roperzh
Copy link
Member Author

roperzh commented May 14, 2024

@mna thanks! was driving me crazy

@roperzh roperzh merged commit 3a31262 into feat-software-installers May 14, 2024
11 of 12 checks passed
@roperzh roperzh deleted the 18325-software-cli branch May 14, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants