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

Allow upgrade agent from actions column #6476

Merged

Conversation

lucianogorza
Copy link
Contributor

@lucianogorza lucianogorza commented Mar 5, 2024

Description

This PR's main objective is to provide Wazuh Dashboard users with the ability to easily update an outdated agent.
To achieve this, the Upgrade button has been added to the actions column of the agent's table.
Additionally, a badge has been included in the Version column to indicate if the agent is not up-to-date.
Finally, if there is any ongoing update, an alert is displayed showing the quantity in progress and the number of failures in the last 60 minutes, with the option to access the details of the failures.

Issues Resolved

#6253

Evidence

image
image
image
image
image
image

Test

Test with real manager and agents

Command to create outdated agent with docker:

docker run --name os-dev-2120-agent-$(date +%s) --network os-dev-2.12.0 --label com.docker.compose.project=os-dev-2120 --env WAZUH_AGENT_VERSION=4.6.0 -d ubuntu:20.04 bash -c '
  apt update -y
  apt install -y curl lsb-release
  curl -so \wazuh-agent-${WAZUH_AGENT_VERSION}.deb \
    https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_${WAZUH_AGENT_VERSION}-1_amd64.deb \
    && WAZUH_MANAGER='wazuh.manager' WAZUH_AGENT_GROUP='default' dpkg -i ./wazuh-agent-${WAZUH_AGENT_VERSION}.deb

  /etc/init.d/wazuh-agent start
  tail -f /var/ossec/logs/ossec.log
'

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

General

Test Chrome Firefox Safari
Version column: up to date agent must show only the version
Version column: outdated agent must show version and a badge
Up to date agent: In actions column click more actions. Upgrade action must be disabled
Outdated online agent: In actions column click more actions. Upgrade action must be enabled
Outdated offline agent: In actions column click more actions. Upgrade action must be disabled

Details

⚫ Version column: up to date agent must show only the version

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Version column: outdated agent must show version and a badge

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Up to date agent: In actions column click more actions. Upgrade action must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Outdated online agent: In actions column click more actions. Upgrade action must be enabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Outdated offline agent: In actions column click more actions. Upgrade action must be disabled

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Upgrade agents

Test Chrome Firefox Safari
Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)
Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown
Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details
On the upgrade tasks modal, check different filters

Details

⚫ Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ On the upgrade tasks modal, check different filters

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@lucianogorza lucianogorza self-assigned this Mar 5, 2024
@lucianogorza lucianogorza force-pushed the enhancement/6253-allow-upgrade-agent-from-actions-column branch from 088b3f0 to 7a8d06d Compare March 5, 2024 19:53
@lucianogorza lucianogorza linked an issue Mar 5, 2024 that may be closed by this pull request
4 tasks
@yenienserrano
Copy link
Member

Maybe we could look for another alternative to show when an agent is out of date, for example a dot as in status and a tooltip, so that it stays in the same line.

@yenienserrano
Copy link
Member

yenienserrano commented Mar 6, 2024

General

Test Chrome Firefox Safari
Version column: up to date agent must show only the version 🟢
Version column: outdated agent must show version and a badge 🟢
Up to date agent: In actions column click more actions. Upgrade action must be disabled 🟢
Outdated online agent: In actions column click more actions. Upgrade action must be enabled 🟢
Outdated offline agent: In actions column click more actions. Upgrade action must be disabled 🟢

Details

🟢 Version column: up to date agent must show only the version

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Version column: outdated agent must show version and a badge

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Up to date agent: In actions column click more actions. Upgrade action must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Outdated online agent: In actions column click more actions. Upgrade action must be enabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Outdated offline agent: In actions column click more actions. Upgrade action must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

Upgrade agents

Test Chrome Firefox Safari
Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped) 🟢
Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown 🟢
Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details 🟢
On the upgrade tasks modal, check different filters 🟡

Details

🟢 Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟡 On the upgrade tasks modal, check different filters

Chrome - 🟡

I updated 1 agent and when I finished the message of 0 agents updating remained
and I can't see the history as when it gives an error

image

Firefox - ⚫

Safari - ⚫

@yenienserrano
Copy link
Member

It is making several requests to check which ones are in progress, ready and failed, and when you open the modal to see the tasks, the requests multiply.

Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

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

LGTM

@asteriscos
Copy link
Member

asteriscos commented Mar 11, 2024

General

Test Chrome Firefox Safari
Version column: up to date agent must show only the version 🟢
Version column: outdated agent must show version and a badge 🟢
Up to date agent: In actions column click more actions. Upgrade action must be disabled 🟢
Outdated online agent: In actions column click more actions. Upgrade action must be enabled 🟢
Outdated offline agent: In actions column click more actions. Upgrade action must be disabled 🟢

Details

🟢 Version column: up to date agent must show only the version

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Version column: outdated agent must show version and a badge

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Up to date agent: In actions column click more actions. Upgrade action must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Outdated online agent: In actions column click more actions. Upgrade action must be enabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

🟢 Outdated offline agent: In actions column click more actions. Upgrade action must be disabled

Chrome - 🟢

image

Firefox - ⚫

Safari - ⚫

Upgrade agents

Test Chrome Firefox Safari
Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped) 🟢
Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown 🟢
Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details 🟢
On the upgrade tasks modal, check different filters 🟢

Details

🟢 Go to an online and outdated agent, and click the upgrade action. Check the progress alert (API requests must be triggered every 3 seconds) and wait until the upgrade is finished (API requests must be stopped)

Chrome - 🟢

Peek 2024-03-11 19-40

image

Firefox - ⚫

Safari - ⚫

🟢 Go to an online and outdated agent, and click the upgrade action. Refresh the entire page. The progress alert must be shown

Chrome - 🟢

Peek 2024-03-11 19-40

Firefox - ⚫

Safari - ⚫

🟢 Go to an online and outdated agent, stop the Docker container, and click the upgrade action. Check the failed alert and open the modal to see the error details

Chrome - 🟢

Peek.2024-03-11.19-21.mp4

Firefox - ⚫

Safari - ⚫

🟢 On the upgrade tasks modal, check different filters

Chrome - 🟢

Peek 2024-03-11 19-27

Firefox - ⚫

Safari - ⚫

@asteriscos asteriscos merged commit 4a9fe77 into 4.9.0 Mar 11, 2024
1 check passed
@asteriscos asteriscos deleted the enhancement/6253-allow-upgrade-agent-from-actions-column branch March 11, 2024 18:49
Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 28.94% ( 286 / 988 )
Branches 26.22% ( 107 / 408 )
Functions 26.87% ( 86 / 320 )
Lines 28.68% ( 278 / 969 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 11.83% ( 4093 / 34584 )
Branches 7.49% ( 1697 / 22644 )
Functions 10.5% ( 862 / 8206 )
Lines 12.02% ( 3986 / 33147 )

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.

Allow upgrade an agent from the actions table
3 participants