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

[Fleet] Agent upgrade form validation fix #204846

Merged

Conversation

Supplementing
Copy link
Contributor

@Supplementing Supplementing commented Dec 18, 2024

Summary

Closes #197399

Implemented a fix when trying to bulk upgrade agents that are on the current version (see issue for further explanation). Instead of a combobox, a text field would be shown but the current version (in line with the kibana version) wasn't automatically being added to the field as intended due to the wrong variable being passed as the value prop. However the correct version was being applied to the behind-the-scenes check, allowing the user to submit even though it looked like nothing had been entered in the field.

  • Fixed value prop on input to use the correct pre-filled value initially
  • Added a check so that if there were errors with the version being typed in, the button would also get disabled to stop submissions with invalid versions

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

Identify risks

n/a

…om submitting when there are errors in the version
@Supplementing Supplementing added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Dec 18, 2024
@Supplementing Supplementing requested a review from a team as a code owner December 18, 2024 22:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@Supplementing Supplementing marked this pull request as draft December 19, 2024 02:05
@Supplementing
Copy link
Contributor Author

Supplementing commented Dec 19, 2024

Additionally, in order to fix failed checks, I removed the 'selectedVersionStr' definition as it wasn't being used for anything.

Now that I think about it more, we should probably also consider setting up a check so that the user entered version is an actual version and LTE the current kibana version. With the current checks, a user could theoretically enter something like 255.34.32 as a version, which is obviously not a real version and it would technically 'pass' and allow them to submit. @nchaulet please advise if this should be added to this PR or as another issue!

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.7MB 1.7MB -11.0B

History

@nchaulet
Copy link
Member

@Supplementing upgrading agent are not necessarily related to stack version and we could upgrade agent to a version higher than Kibana or a build version, so I am not sure we want to validate too much here, I think testing semver is valid is probably good enough and in line with the server side validation we already added

version: schema.string({ validate: validateVersion }),

@Supplementing Supplementing marked this pull request as ready for review December 19, 2024 13:34
Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@Supplementing Supplementing merged commit 37df206 into elastic:main Dec 19, 2024
8 checks passed
@Supplementing Supplementing deleted the fix-agent-upgrade-form-validation branch December 19, 2024 19:49
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12419753443

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 19, 2024
## Summary

Closes elastic#197399

Implemented a fix when trying to bulk upgrade agents that are on the
current version (see issue for further explanation). Instead of a
combobox, a text field would be shown but the current version (in line
with the kibana version) wasn't automatically being added to the field
as intended due to the wrong variable being passed as the `value` prop.
However the correct version was being applied to the behind-the-scenes
check, allowing the user to submit even though it looked like nothing
had been entered in the field.

- Fixed `value` prop on input to use the correct pre-filled value
initially
- Added a check so that if there were errors with the version being
typed in, the button would also get disabled to stop submissions with
invalid versions

### 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](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
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](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) 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](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

n/a

(cherry picked from commit 37df206)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 19, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Agent upgrade form validation fix
(#204846)](#204846)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mason
Herron","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-19T19:49:36Z","message":"[Fleet]
Agent upgrade form validation fix (#204846)\n\n## Summary\r\n\r\nCloses
#197399 \r\n\r\nImplemented a fix when trying to bulk upgrade agents
that are on the\r\ncurrent version (see issue for further explanation).
Instead of a\r\ncombobox, a text field would be shown but the current
version (in line\r\nwith the kibana version) wasn't automatically being
added to the field\r\nas intended due to the wrong variable being passed
as the `value` prop.\r\nHowever the correct version was being applied to
the behind-the-scenes\r\ncheck, allowing the user to submit even though
it looked like nothing\r\nhad been entered in the field.\r\n\r\n- Fixed
`value` prop on input to use the correct pre-filled
value\r\ninitially\r\n- Added a check so that if there were errors with
the version being\r\ntyped in, the button would also get disabled to
stop submissions with\r\ninvalid versions\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify
risks\r\n\r\nn/a","sha":"37df2060958a2835875e96db064bb0ed212b7677","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
Agent upgrade form validation
fix","number":204846,"url":"https://github.com/elastic/kibana/pull/204846","mergeCommit":{"message":"[Fleet]
Agent upgrade form validation fix (#204846)\n\n## Summary\r\n\r\nCloses
#197399 \r\n\r\nImplemented a fix when trying to bulk upgrade agents
that are on the\r\ncurrent version (see issue for further explanation).
Instead of a\r\ncombobox, a text field would be shown but the current
version (in line\r\nwith the kibana version) wasn't automatically being
added to the field\r\nas intended due to the wrong variable being passed
as the `value` prop.\r\nHowever the correct version was being applied to
the behind-the-scenes\r\ncheck, allowing the user to submit even though
it looked like nothing\r\nhad been entered in the field.\r\n\r\n- Fixed
`value` prop on input to use the correct pre-filled
value\r\ninitially\r\n- Added a check so that if there were errors with
the version being\r\ntyped in, the button would also get disabled to
stop submissions with\r\ninvalid versions\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify
risks\r\n\r\nn/a","sha":"37df2060958a2835875e96db064bb0ed212b7677"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204846","number":204846,"mergeCommit":{"message":"[Fleet]
Agent upgrade form validation fix (#204846)\n\n## Summary\r\n\r\nCloses
#197399 \r\n\r\nImplemented a fix when trying to bulk upgrade agents
that are on the\r\ncurrent version (see issue for further explanation).
Instead of a\r\ncombobox, a text field would be shown but the current
version (in line\r\nwith the kibana version) wasn't automatically being
added to the field\r\nas intended due to the wrong variable being passed
as the `value` prop.\r\nHowever the correct version was being applied to
the behind-the-scenes\r\ncheck, allowing the user to submit even though
it looked like nothing\r\nhad been entered in the field.\r\n\r\n- Fixed
`value` prop on input to use the correct pre-filled
value\r\ninitially\r\n- Added a check so that if there were errors with
the version being\r\ntyped in, the button would also get disabled to
stop submissions with\r\ninvalid versions\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify
risks\r\n\r\nn/a","sha":"37df2060958a2835875e96db064bb0ed212b7677"}}]}]
BACKPORT-->

Co-authored-by: Mason Herron <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: User is able to trigger schedule agent upgrade from bulk actions without adding agent version.
4 participants