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

Change to approprite error msg when directory not found in cache intel #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Aishwarya-Lad
Copy link

@Aishwarya-Lad Aishwarya-Lad commented Feb 1, 2024

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Fixes:
Appropriate error message when directory not found for restore/save.

Proposed Changes

  • Change of error message in case of directory not found

Description

Test:
https://app.harness.io/ng/account/9UuUfLwaQ-6ZowvbG7qtLQ/home/orgs/default/projects/aishwaryawksp/pipelines/CI10788/executions/gfxDwpKyRCerkqoAm5QS8w/pipeline

Checklist

  • Read the CONTRIBUTING document.
  • Read the CODE OF CONDUCT document.
  • [] Add tests to cover changes.
  • Ensure your code follows the code style of this project.
  • Ensure CI and all other PR checks are green OR
    • Code compiles correctly.
    • Created tests which fail without the change (if possible).
    • All new and existing tests passed.
  • Add your changes to Unreleased section of CHANGELOG.
  • Improve and update the README (if necessary).
  • Ensure documentation is up-to-date. The same file will be updated in plugin index when your PR is accepted, so it will be available for end-users at http://plugins.drone.io.

@@ -140,7 +140,7 @@ func (r rebuilder) rebuild(src, dst string) (err error) {
tr := io.TeeReader(pr, sw)

if err := r.s.Put(dst, tr); err != nil {
err = fmt.Errorf("upload file, pipe reader failed, %w", err)
err = fmt.Errorf("failure in uploading file to archived directory, %w", err)

Choose a reason for hiding this comment

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

failed to upload file to cache storage

Choose a reason for hiding this comment

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

Doe this print the archive name (and associated cache path)?

Copy link
Author

Choose a reason for hiding this comment

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

No, it prints just the cache path.

@@ -120,7 +120,7 @@ func (r restorer) restore(src, dst string) (err error) {

written, err := r.a.Extract(dst, pr)
if err != nil {
err = fmt.Errorf("extract files from downloaded archive, pipe reader failed, %w", err)
err = fmt.Errorf("failure in extracting files from downloaded archive, %w", err)

Choose a reason for hiding this comment

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

failed to extract files from downloaded archive

Choose a reason for hiding this comment

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

Does this print the archive name (and associated cache path)?

Modify error msg to warning msg

modify error
@@ -93,7 +93,7 @@ func (r rebuilder) Rebuild(srcs []string) error {
wg.Wait()

if errs.Err() != nil {
return fmt.Errorf("rebuild failed, %w", errs)
level.Warn(r.logger).Log("msg", "ignore archival, ", errs.Err())

Choose a reason for hiding this comment

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

The message is unclear IMO. When will the Err() be not nil? We should be checking for the case where the path directory doesn't exist and only then ignore it instead of ignoring it for all errors. Also let's print it clearly: path %s doesn't exist. Ignoring save to cache or similar.

Choose a reason for hiding this comment

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

I think this should only just print warning when it's auto detected. This will change old behavior right?

@@ -140,7 +140,7 @@ func (r rebuilder) rebuild(src, dst string) (err error) {
tr := io.TeeReader(pr, sw)

if err := r.s.Put(dst, tr); err != nil {
err = fmt.Errorf("upload file, pipe reader failed, %w", err)
err = fmt.Errorf("failed to upload file to cache storage, %w", err)
if err := pr.CloseWithError(err); err != nil {
level.Error(r.logger).Log("msg", "pr close", "err", err)

Choose a reason for hiding this comment

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

Let's use a better message instead of "pr close"

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.

3 participants