Skip to content

Conversation

@kaanyalti
Copy link

@kaanyalti kaanyalti commented Aug 12, 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

@kaanyalti kaanyalti marked this pull request as ready for review August 12, 2025 14:29
@kaanyalti kaanyalti requested a review from a team as a code owner August 12, 2025 14:29
@mergify
Copy link
Contributor

mergify bot commented Aug 12, 2025

This pull request does not have a backport label. Could you fix it @kaanyalti? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@kaanyalti kaanyalti added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-active-all Automated backport with mergify to all the active branches labels Aug 12, 2025
@elasticmachine
Copy link
Collaborator

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

@kaanyalti kaanyalti marked this pull request as draft August 12, 2025 14:31
@kaanyalti kaanyalti force-pushed the enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack branch 3 times, most recently from c264d61 to 802866c Compare August 13, 2025 11:22
@kaanyalti kaanyalti marked this pull request as ready for review August 13, 2025 11:45
@kaanyalti kaanyalti closed this Aug 13, 2025
@kaanyalti kaanyalti deleted the enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack branch August 13, 2025 11:53
@kaanyalti kaanyalti restored the enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack branch August 13, 2025 11:58
@kaanyalti kaanyalti reopened this Aug 13, 2025
@kaanyalti
Copy link
Author

Accidentally pushed the wrong remote branch name to delete, reopened after re-publishing branch.

@kaanyalti
Copy link
Author

kaanyalti commented Aug 13, 2025

nolint:gosec linting error is fixed in #9347

@mergify
Copy link
Contributor

mergify bot commented Aug 13, 2025

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack upstream/enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack
git merge upstream/main
git push upstream enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack

@kaanyalti kaanyalti force-pushed the enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack branch from 4a7b718 to 829bf60 Compare September 8, 2025 14:58
@kaanyalti kaanyalti marked this pull request as ready for review September 8, 2025 17:40
@elastic-sonarqube
Copy link

@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @kaanyalti

@kaanyalti kaanyalti merged commit f70ff02 into elastic:main Sep 9, 2025
23 checks passed
@kaanyalti kaanyalti deleted the enhancement/5235_handle_insufficient_disk_space_errors_in_artifact_unpack branch September 9, 2025 01:16
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

@Mergifyio backport 8.18 8.19 9.0 9.1

@mergify
Copy link
Contributor

mergify bot commented Sep 9, 2025

backport 8.18 8.19 9.0 9.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 9, 2025
…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 bot pushed a commit that referenced this pull request Sep 9, 2025
…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 bot pushed a commit that referenced this pull request Sep 9, 2025
…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_test.go
mergify bot pushed a commit that referenced this pull request Sep 9, 2025
…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)
kaanyalti pushed a commit that referenced this pull request Sep 12, 2025
…pack (#9322) (#9821)

* 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)

Co-authored-by: Kaan Yalti <kaan.yalti@elastic.co>
kaanyalti pushed a commit that referenced this pull request Sep 12, 2025
…e errors in artifact unpack (#9820)

* Enhancement/5235 handle insufficient disk space errors in artifact unpack (#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_test.go

* resolve conflicts

---------

Co-authored-by: Kaan Yalti <kaan.yalti@elastic.co>
kaanyalti pushed a commit that referenced this pull request Sep 12, 2025
…ce errors in artifact unpack (#9819)

* Enhancement/5235 handle insufficient disk space errors in artifact unpack (#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

* resolve conflicts

---------

Co-authored-by: Kaan Yalti <kaan.yalti@elastic.co>
kaanyalti pushed a commit that referenced this pull request Sep 12, 2025
…ce errors in artifact unpack (#9818)

* Enhancement/5235 handle insufficient disk space errors in artifact unpack (#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

* resolve conflicts

---------

Co-authored-by: Kaan Yalti <kaan.yalti@elastic.co>
Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
intxgo pushed a commit to intxgo/elastic-agent that referenced this pull request Sep 24, 2025
…pack (elastic#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants