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

feat: filter host software by label scoping #24801

Merged
merged 14 commits into from
Dec 16, 2024

Conversation

jahzielv
Copy link
Contributor

@jahzielv jahzielv commented Dec 16, 2024

Related issue: #24534

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.
  • 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

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (feat-labels-scoped-software@23a6146). Learn more about missing BASE report.

Additional details and impacted files
@@                      Coverage Diff                       @@
##             feat-labels-scoped-software   #24801   +/-   ##
==============================================================
  Coverage                               ?   63.60%           
==============================================================
  Files                                  ?     1603           
  Lines                                  ?   151900           
  Branches                               ?     3857           
==============================================================
  Hits                                   ?    96620           
  Misses                                 ?    47600           
  Partials                               ?     7680           
Flag Coverage Δ
backend 64.39% <100.00%> (?)

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.

@jahzielv jahzielv marked this pull request as ready for review December 16, 2024 21:24
@jahzielv jahzielv requested a review from a team as a code owner December 16, 2024 21:24
// We should have [installerID1]
software, _, err = ds.ListHostSoftware(ctx, host, opts)
require.NoError(t, err)
require.Len(t, software, 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here and elsewhere I could probably tighten up the checks by validating the IDs returned. Since there is other testing fixup to do, I will tackle this in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Probably best to add it to the catch-all ticket too so we don't forget about this.

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.

LGTM!

sil.software_installer_id = si.id
AND sil.exclude = 1
HAVING
count_installer_labels > 0 AND count_host_labels = 0
Copy link
Member

Choose a reason for hiding this comment

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

One thing I did not think of mentioning earlier, the exclude_any case will suffer from the same issue as for the configuration profiles - for dynamic labels (based on a query result), all hosts appear to not be members until we ingest the first result for that host. So this could show an installer as "available" for a host even though once we ingest the dynamic label query results, it should've been excluded. This was fixed with timestamp checks for config profiles.

I think it'd be fine to merge as-is and worry about that exclude-any corner case later on, maybe as a "holistic" approach for the whole story? Would you mind adding it to the catch-all ticket if that approach make sense to you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

aha, that's a good point. I can add it to the catch all.

// We should have [installerID1]
software, _, err = ds.ListHostSoftware(ctx, host, opts)
require.NoError(t, err)
require.Len(t, software, 1)
Copy link
Member

Choose a reason for hiding this comment

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

Probably best to add it to the catch-all ticket too so we don't forget about this.

@jahzielv jahzielv merged commit 7e3a7ba into feat-labels-scoped-software Dec 16, 2024
22 checks passed
@jahzielv jahzielv deleted the 24534-hide-software-2 branch December 16, 2024 22:02
@jahzielv jahzielv mentioned this pull request Dec 16, 2024
3 tasks
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.

2 participants