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

[8.17](backport #6273) Log warning on same version upgrade to prevent failed status #6474

Open
wants to merge 3 commits into
base: 8.17
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jan 2, 2025

What does this PR do?

Log warning on same version upgrade and filter error to prevent upgrade status reporting.
If a user attempts to upgrade to the same version, the elastic-agent upgrade call will exit with an error, but the agent's status will be cleared of any upgrade markers.

Include an earlier check for same-version upgrades before artifacts are downloaded to prevent unnecessary downloads

Why is it important?

Currently upgrading to the same version results in the agent reporting a failed state until a successful upgrade can be done.

Testing instructions

Install a stand-alone agent and use elastic-agent upgrade 9.0.0-SNAPSHOT --source-uri file://path/to/dir --skip-verification to upgrade the agent

For example:

# Install the agent
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo ./elastic-agent install --develop
Installing into development namespace; this is an experimental and currently unsupported feature.
Elastic Agent will be installed at /Library/Elastic/Agent-Development and will run as a service. Do you want to continue? [Y/n]:y
Do you want to enroll this Agent into Fleet? [Y/n]:n
[   =] Service Started  [4s] Elastic Agent successfully installed, starting enrollment.
[   =] Done  [4s]
Elastic Agent has been successfully installed.

# Check status and version
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo elastic-development-agent version
Binary: 9.0.0-SNAPSHOT (build: 14e78753e6c06295e3348a00de01ae54905fb2c0 at 2024-12-18 18:30:32 +0000 UTC)
Daemon: 9.0.0-SNAPSHOT (build: 14e78753e6c06295e3348a00de01ae54905fb2c0 at 2024-12-18 18:30:32 +0000 UTC)
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo elastic-development-agent status
┌─ fleet
│  └─ status: (STOPPED) Not enrolled into Fleet
└─ elastic-agent
   └─ status: (HEALTHY) Running

# attempt to upgrade to the same version
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo elastic-development-agent upgrade 9.0.0-SNAPSHOT --source-uri file:///Users/mlaterman/git/elastic-agent/build/distributions/ --skip-verify
Upgrade triggered to version 9.0.0-SNAPSHOT, Elastic Agent is currently restarting
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ echo $?
0
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo elastic-development-agent status
┌─ fleet
│  └─ status: (STOPPED) Not enrolled into Fleet
└─ elastic-agent
   └─ status: (HEALTHY) Running
elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64|⇒ sudo elastic-development-agent version
Binary: 9.0.0-SNAPSHOT (build: 14e78753e6c06295e3348a00de01ae54905fb2c0 at 2024-12-18 18:30:32 +0000 UTC)
Daemon: 9.0.0-SNAPSHOT (build: 14e78753e6c06295e3348a00de01ae54905fb2c0 at 2024-12-18 18:30:32 +0000 UTC)

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

N/A

Related issues

Log warning on same version upgrade and filter error to prevent upgrade status reporting.
If a user attempts to upgrade to the same version, the elastic-agent upgrade call will exit with an error, but the agent's status will be cleared of any upgrade markers.

Include an earlier check for same-version upgrades before artifacts are downloaded to prevent unnecessary downloads

---------

Co-authored-by: Paolo Chilà <[email protected]>
(cherry picked from commit d354d9f)
@mergify mergify bot requested a review from a team as a code owner January 2, 2025 20:08
@mergify mergify bot added the backport label Jan 2, 2025
@mergify mergify bot requested review from blakerouse and kaanyalti and removed request for a team January 2, 2025 20:08
@michel-laterman michel-laterman enabled auto-merge (squash) January 2, 2025 22:14
Copy link
Contributor Author

mergify bot commented Jan 6, 2025

This pull request has not been merged yet. Could you please review and merge it @michel-laterman? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants