Skip to content

porter archive fails on windows #2917

@ludfjig

Description

@ludfjig

Describe the bug

porter archive fails intermittently on windows. This is due to a race condition in go-containerregistry.

To Reproduce

Run
porter archive name.tgz -r ghcr.io/getporter/examples/whalegap:v0.2.0 on windows (on my branch, otherwise you'll get an error that has been fixed since, but not yet merged).
You'll notice that about 50% of the time, you'll get an error such as this one

error preparing bundle artifact: error writing layer: rename C:\Users\LLILJE~1\AppData\Local\Temp\examples-whalegap-0.2.0827645715\artifacts\layout\blobs\sha256\a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4706634942 C:\Users\LLILJE~1\AppData\Local\Temp\examples-whalegap-0.2.0827645715\artifacts\layout\blobs\sha256\a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4: Access is denied.
error preparing bundle artifact: error writing layer: rename C:\Users\LLILJE~1\AppData\Local\Temp\examples-whalegap-0.2.0827645715\artifacts\layout\blobs\sha256\a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4706634942 C:\Users\LLILJE~1\AppData\Local\Temp\examples-whalegap-0.2.0827645715\artifacts\layout\blobs\sha256\a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4: Access is denied.

With the example bundle, the offending file is always the one starting with "a3....".

The error comes from an os.Rename which fails with ERROR_ACCESS_DENIED. On windows, you can only rename a file that is not opened by any other process. I have used handle.exe to confirm that the file handle isn't open by another process (I think).

 

Expected behavior

The command should work 100% of the time.

Version

My windows branch https://github.com/ludfjig/porter/tree/win_integrationtest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugOops, sorry!windows🪟related to running porter on windows

    Type

    No type

    Projects

    Status

    ✅ Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions