Azure / acr-builder

Azure Container Registry Build Runner
MIT License
38 stars 35 forks source link

add troubleshooting logs in acb download #654

Closed yuehaoliang closed 11 months ago

yuehaoliang commented 11 months ago

Purpose of the PR Observed some "unexpected EOF" when downloading the context, so add more logs for troubleshooting.

time="2023-10-05T16:49:50Z" level=debug msg="Output from downloading: unexpected EOF\n" time="2023-10-05T16:49:50Z" level=warning msg="Failed to download source context. Error: exit status 1"

I think "unexpected EOF" is likely originated from archive.Untar(). This method will throw "unexpected EOF" if the content is invalid or corrupted. If so, these logs may not be very helpful. Any suggestions?

Fixes #

northtyphoon commented 11 months ago

Can we add a retry in case of Intermittent download error?

https://github.com/Azure/acr-builder/issues/653

yuehaoliang commented 11 months ago

Can we add a retry in case of Intermittent download error?

653

Sure, I will add a retry.

I also wanted to wish some luck in seeing how docker import is written for streaming, but it turns out we had already adapted the code from Moby, moby/api/server/router/image/image_routes.go. I still see some differences in the way it's written, and I plan to try it out.

yuehaoliang commented 11 months ago

After the change, an example log will be:

time="2023-11-01T07:30:54Z" level=debug msg="Output from downloading: 2023/11/01 07:30:53 Downloading context\nGetting context from URL\nRead context with status code 200\nRead context of 4762 bytes\nstarting to untar context\nfatal: not a git repository (or any parent up to mount point /)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\nfatal: not a git repository (or any parent up to mount point /)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n2023/11/01 07:30:53 Download complete, working directory: /workspace\n2023/11/01 07:30:53 CommitID and Branch information: {\"commitID\":\"\",\"branch\":\"\"}\n"