Skip to content

feat(discovery): report available content pack versions in metadata - #129

Merged
blue4209211 merged 2 commits into
mainfrom
feat/pack-versions-metadata
Aug 8, 2026
Merged

feat(discovery): report available content pack versions in metadata#129
blue4209211 merged 2 commits into
mainfrom
feat/pack-versions-metadata

Conversation

@mayankpande88

Copy link
Copy Markdown
Contributor

Description

discovery_inventory requires the caller to pin content_pack_version — there is no "latest" default, by design (packs are locally cached, signature-verified files). But nothing told the server which versions an agent actually has, so a server-side caller would have to hardcode a version and find out at call time whether it exists.

CollectMetadata now includes a pack_versions field: the linux-inventory-v<N>.yaml versions present in pack_dir, ascending. This rides the existing datasource_metadata message, which the relay already persists into integrations.labels, so the server can pick a version to pin instead of guessing. The key is absent when no pack_dir is configured — same as an older agent that predates the field. Presence means the file exists; signature verification still happens at execution time, unchanged.

Server-side consumer context: nudgebee/nudgebee-enterprise#35881 (discovery datasource registration) and the scan pipeline in nudgebee/nudgebee-enterprise#35822.

Part of #116.

Type of change

  • Enhancement (non-breaking change which improves existing functionality)

How Has This Been Tested?

  • Unit tests: version listing (ordering, non-matching files ignored) and key absence without pack_dir
  • Manual testing

Checklist

  • CLA signed (the CLA bot will prompt on your first PR)
  • make validate passes (fmt + lint + test)
  • Docs updated if the wire shape, config surface, or proxy module behavior changed — the new field is optional and documented at the source; docs/proxy-modules.md has no discovery section yet (pre-existing gap, not extended here)

discovery_inventory requires the caller to pin content_pack_version (no
'latest' default), but nothing told the server which versions this agent
has. CollectMetadata now lists the linux-inventory-v<N>.yaml versions
present in pack_dir, ascending, so the server can pick one instead of
hardcoding. Presence means the file exists; signature verification still
happens at execution time.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request implements content pack version reporting in the discovery proxy metadata. It scans the configured pack_dir for files matching linux-inventory-v<N>.yaml, extracts and sorts the version numbers, and includes them in the collected metadata. A test suite has also been added to verify this behavior. The review feedback suggests ignoring 'not exist' errors when reading pack_dir to prevent misleading warning logs on fresh installations before content packs are synced.

Comment thread pkg/proxy/discovery/proxy.go
A configured-but-not-yet-created pack_dir is a normal fresh-install
state; warning on every metadata cycle for it is noise.
@blue4209211
blue4209211 merged commit 40db44a into main Aug 8, 2026
6 checks passed
@blue4209211
blue4209211 deleted the feat/pack-versions-metadata branch August 8, 2026 07:14
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