Skip to content

Conversation

@r10r
Copy link

@r10r r10r commented Aug 24, 2023

Restic exit's with exit code 1 when the target directory is empty. This is not an error condition and the exit code
should not be logged in this case.

Please add a summary of your change

It really confused me to see the following error in the output when updating to v1.12.0-rc.1

time="2023-08-24T17:12:28Z" level=error msg="Restic command fail with ExitCode: 1. Process ID is 26, Exit error is: exit status 1" backup=velero2/gitea-backup-6 controller=podvolumebackup logSource="pkg/util/exec/exec.go:66" parentSnapshot= path="/host_pods/4d7c854f-9d1e-4ff0-a594-26ca68d3d2df/volumes/kubernetes.io~empty-dir/tmp" podvolumebackup=velero2/gitea-backup-6-5wnhb
time="2023-08-24T17:12:28Z" level=debug msg="Restic backup got empty dir with /host_pods/4d7c854f-9d1e-4ff0-a594-26ca68d3d2df/volumes/kubernetes.io~empty-dir/tmp path" backup=velero2/gitea-backup-6 controller=podvolumebackup logSource=

Please note that the second log line is only shown when debug logging is enabled.
The change in logging was introduced with #6459

Does your change fix a particular issue?

No because I did not create one.

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

Restic exit's with exit code 1 when the target directory is empty.
This is not an error condition and the exit code
should not be logged in this case.

Signed-off-by: Ruben Jenster <[email protected]>
@Lyndon-Li Lyndon-Li requested a review from blackpiglet August 28, 2023 06:27
@blackpiglet blackpiglet added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Aug 30, 2023
@blackpiglet
Copy link
Contributor

blackpiglet commented Aug 30, 2023

@qiuming-best
Please take a look at this PR.
Is it possible to move the check earlier when the error is reported, for example in pkg/restic/exec_commands.go's function RunBackup?

		if strings.Contains(stderrBuf, "snapshot is empty") {
			log.Debugf("Restic backup got empty dir with %s path", path)
			return "", true, nil
		}

@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #6699 (b6d41ab) into main (4975437) will increase coverage by 0.00%.
Report is 7 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #6699   +/-   ##
=======================================
  Coverage   60.36%   60.36%           
=======================================
  Files         242      242           
  Lines       25982    25981    -1     
=======================================
+ Hits        15683    15684    +1     
+ Misses       9196     9194    -2     
  Partials     1103     1103           
Files Changed Coverage Δ
pkg/restic/exec_commands.go 15.21% <ø> (+0.16%) ⬆️
pkg/uploader/provider/restic.go 80.73% <100.00%> (+0.17%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants