-
Notifications
You must be signed in to change notification settings - Fork 123
Add required_versions attribute to fleet_agent_policy for automatic agent upgrades #1436
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
Open
Copilot
wants to merge
12
commits into
main
Choose a base branch
from
copilot/add-required-versions-attribute
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+325
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: tobio <[email protected]>
Co-authored-by: tobio <[email protected]>
Co-authored-by: tobio <[email protected]>
Copilot
AI
changed the title
[WIP] Add required versions attribute to fleet policy
Add required_versions attribute to fleet_agent_policy for automatic agent upgrades
Nov 12, 2025
Copilot finished work on behalf of
tobio
November 12, 2025 04:10
…type Co-authored-by: tobio <[email protected]>
Contributor
Author
Co-authored-by: Copilot <[email protected]>
…ndling Co-authored-by: tobio <[email protected]>
Contributor
Author
Copilot finished work on behalf of
tobio
November 12, 2025 06:38
Co-authored-by: tobio <[email protected]>
Copilot finished work on behalf of
tobio
November 13, 2025 04:55
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Review Comments Addressed ✅
All review feedback has been implemented:
1. Float32 to Int32 Conversion (Comment 2516972762)
populateFromAPI()to properly round float32 percentages to nearest integerint32(rv.Percentage + 0.5)toint32(math.Round(float64(rv.Percentage)))for explicit rounding semantics and better edge case handling2. Version Check for Required Versions (Comment 2517041678)
MinVersionRequiredVersions = version.Must(version.NewVersion("9.1.0"))constantSupportsRequiredVersionsfeature flag to thefeaturesstructbuildFeatures()to check for 9.1.0+ supportconvertRequiredVersions()to validate version support and return appropriate errorminVersionRequiredVersionsand skip on older versions3. Empty Map Clears Upgrades (Comment 2517045478)
convertRequiredVersions()to return empty array (not nil) whenrequired_versions = {}Changes Summary
Files Modified:
internal/fleet/agent_policy/resource.go- Added MinVersionRequiredVersions constant and feature detectioninternal/fleet/agent_policy/models.go- Added SupportsRequiredVersions to features, improved conversions with math.Round(), added version validationinternal/fleet/agent_policy/acc_test.go- Added minVersionRequiredVersions variable and updated test skip conditionsKey Improvements:
math.Round()for proper, explicit rounding semantics instead of+ 0.5truncation{}now properly clears automatic upgradesAll tests pass and linter is happy!
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.