Skip to content

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 9, 2025

PR 2/6

  • Enhancement

What does this PR do?

Why is it important?

Non-wrapped errors mask the underlying disk space error when using errors.Is. This is need to address the original issue.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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

If the agent runs into disk space errors when it is unpacking the downloaded agent archive, the status and fleet ui will show "insufficient disk space" as the error message

How to test this PR locally

  • Build for windows, mac, linux

  • Install agent (managed and standalone)

  • Fill up disk until there is approximately 500mb left

  • Trigger upgrade

    • From fleet
    • Cli with remote url and file
  • Validate the upgrade detail error message shows insufficient disk error message both in the status output and on fleet ui.

  • Run the upgrade, step_unpack tests

Related issues


This is an automatic backport of pull request #9322 done by [Mergify](https://mergify.com).

…pack (#9322)

* enhancement(5235): added stdlib wrappers in step_unpack

* enhancement(5235): wrap errors in step_unpack

* enhancement(5235): removed nolint:gosec comment from step_unpack

* enhancement(5235): refactored unpack step to abstract the unpack function from upgrader. abstracted unzip and untar to be able to test unpack function. updated unpack step tests to test for stdlib failures in unzip and untar and added tests for unpack

* enhancement(5235}: added unpackHandler interface to abstract the unpack function from upgrader

* enhancement(5235): added getPackageMetadata into unpackHandler interface for testability

* enhancement(5235): using unpacker.getPackageMetadata

* enhancement(5235): added abstractions in upgrader for testability

* enhancement(5235): removed unpack specific test from upgrade tests, added test cases in the upgrade error handling test

* enhancement(5235): using formatted test assertion api

(cherry picked from commit f70ff02)

# Conflicts:
#	internal/pkg/agent/application/upgrade/step_unpack.go
#	internal/pkg/agent/application/upgrade/step_unpack_test.go
#	internal/pkg/agent/application/upgrade/upgrade.go
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Sep 9, 2025
@mergify mergify bot requested a review from a team as a code owner September 9, 2025 01:16
@mergify mergify bot requested review from michalpristas and blakerouse and removed request for a team September 9, 2025 01:16
Copy link
Contributor Author

mergify bot commented Sep 9, 2025

Cherry-pick of f70ff02 has failed:

On branch mergify/bp/8.19/pr-9322
Your branch is up to date with 'origin/8.19'.

You are currently cherry-picking commit f70ff023f.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   internal/pkg/agent/application/upgrade/upgrade_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   internal/pkg/agent/application/upgrade/step_unpack.go
	both modified:   internal/pkg/agent/application/upgrade/step_unpack_test.go
	both modified:   internal/pkg/agent/application/upgrade/upgrade.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@kaanyalti kaanyalti removed the conflicts There is a conflict in the backported pull request label Sep 12, 2025
Copy link

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @kaanyalti

@kaanyalti kaanyalti merged commit 1b10ed9 into 8.19 Sep 12, 2025
20 checks passed
@kaanyalti kaanyalti deleted the mergify/bp/8.19/pr-9322 branch September 12, 2025 22:45
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