Skip to content

feat(fleet): add support for duration variable type#231027

Merged
andrewkroh merged 6 commits intoelastic:mainfrom
andrewkroh:feat/fleet-duration-var-type
Sep 5, 2025
Merged

feat(fleet): add support for duration variable type#231027
andrewkroh merged 6 commits intoelastic:mainfrom
andrewkroh:feat/fleet-duration-var-type

Conversation

@andrewkroh
Copy link
Copy Markdown
Member

@andrewkroh andrewkroh commented Aug 7, 2025

Summary

This commit introduces support for a duration variable type in Fleet package
policies, aligning with the package-spec v3.5.0.

This change adds min_duration and max_duration constraints, allowing
packages to define acceptable ranges for duration values. This provides
immediate validation and feedback for users in the UI and API, preventing
invalid or out-of-range duration inputs.

Relates elastic/package-spec#948

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Screenshots

Screenshot 2025-08-07 at 14 31 57 Screenshot 2025-08-07 at 14 31 48 Screenshot 2025-08-07 at 14 31 35

Release note

Adds support for a new duration variable type in Fleet packages which provides better input validation of duration strings (e.g. 1h30m) in configurations.

@andrewkroh andrewkroh added release_note:enhancement backport:skip This PR does not require backporting Team:Fleet Team label for Observability Data Collection Fleet team labels Aug 7, 2025
@andrewkroh andrewkroh marked this pull request as ready for review August 7, 2025 19:26
@andrewkroh andrewkroh requested a review from a team as a code owner August 7, 2025 19:26
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@andrewkroh andrewkroh marked this pull request as draft August 7, 2025 21:05
@andrewkroh andrewkroh force-pushed the feat/fleet-duration-var-type branch from 1af15b9 to fdd7aed Compare August 8, 2025 00:18
Add support for a new RegistryVarType named 'duration' with validation logic.

The implementation includes:
- Add 'duration' to RegistryVarType enum
- Add 'min_duration' and 'max_duration' to RegistryVarsEntryKeys
- Implement duration parsing and validation logic
- Add validation for min/max duration constraints
- Add unit tests

Relates elastic/package-spec#948
@andrewkroh andrewkroh force-pushed the feat/fleet-duration-var-type branch from fdd7aed to c18bf1f Compare August 8, 2025 00:18
@andrewkroh andrewkroh changed the title feat(fleet): add support for duration input type Aug 8, 2025
@andrewkroh andrewkroh marked this pull request as ready for review August 8, 2025 10:57
Copy link
Copy Markdown
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewkroh andrewkroh enabled auto-merge (squash) August 19, 2025 21:50
@andrewkroh andrewkroh merged commit 6dbb8d0 into elastic:main Sep 5, 2025
13 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1466 1468 +2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 172.9KB 174.7KB +1.9KB
Unknown metric groups

API count

id before after diff
fleet 1598 1600 +2

History

shahargl pushed a commit to shahargl/kibana that referenced this pull request Sep 7, 2025
This commit introduces support for a `duration` variable type in Fleet package
policies, aligning with the package-spec v3.5.0.

This change adds `min_duration` and `max_duration` constraints, allowing
packages to define acceptable ranges for duration values. This provides
immediate validation and feedback for users in the UI and API, preventing
invalid or out-of-range duration inputs.

Relates elastic/package-spec#948
KodeRad pushed a commit to KodeRad/kibana that referenced this pull request Sep 15, 2025
This commit introduces support for a `duration` variable type in Fleet package
policies, aligning with the package-spec v3.5.0.

This change adds `min_duration` and `max_duration` constraints, allowing
packages to define acceptable ranges for duration values. This provides
immediate validation and feedback for users in the UI and API, preventing
invalid or out-of-range duration inputs.

Relates elastic/package-spec#948
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
This commit introduces support for a `duration` variable type in Fleet package
policies, aligning with the package-spec v3.5.0.

This change adds `min_duration` and `max_duration` constraints, allowing
packages to define acceptable ranges for duration values. This provides
immediate validation and feedback for users in the UI and API, preventing
invalid or out-of-range duration inputs.

Relates elastic/package-spec#948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v9.2.0

4 participants