-
Notifications
You must be signed in to change notification settings - Fork 203
Enhancement/5235 handle insufficient disk space errors in artifact unpack #9322
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
Enhancement/5235 handle insufficient disk space errors in artifact unpack #9322
Conversation
|
This pull request does not have a backport label. Could you fix it @kaanyalti? 🙏
|
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
c264d61 to
802866c
Compare
|
Accidentally pushed the wrong remote branch name to delete, reopened after re-publishing branch. |
|
nolint:gosec linting error is fixed in #9347 |
e81981e to
00793b2
Compare
|
This pull request is now in conflicts. Could you fix it? 🙏 |
4a7b718 to
829bf60
Compare
|
💛 Build succeeded, but was flaky
Failed CI Steps
History
cc @kaanyalti |
|
@Mergifyio backport 8.18 8.19 9.0 9.1 |
✅ Backports have been created
|
…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
…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
…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
…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)
…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>
…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>
…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>
…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>
…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




PR 2/6
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 made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in./changelog/fragmentsusing the changelog toolDisruptive 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
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