Skip to content

Conversation

@joshmgross
Copy link
Contributor

Resolves #91

On the Windows Hosted Runners, GNU tar is prepended to the path from the installation of minGW (http://www.mingw.org/). This version of tar doesn't work out of the box with Windows file paths, and required using --force-local and \ file manipulation to work correctly.

On self-hosted runners, there's no guarantee that tar on the PATH will be GNU tar, and BSD tar will fail when encountering the extra --force-local option.

This change enforces using the BSD Tar on Windows, allowing for self-hosted runners to use this action. Self-hosted runners without the system tar will fail, but this is better than the current situation where no self-hosted runners work.

Most of the changes in this PR are just moving the tar code into its own module to isolate testing and reduce repeated code.

The only behavior change is in getTarPath

I verified these changes with a new cache as well as using a cache created by the current v1 to verify compatibility: https://github.com/joshmgross/cache-canary/runs/346337525

@yacaovsnc
Copy link
Contributor

yacaovsnc commented Dec 13, 2019

Do you know if bsd tar will be available on all windows versions? Including windows servers?

If we are concerned about tar differences, would it be more safe to use the npm tar package? https://www.npmjs.com/package/tar

@joshmgross
Copy link
Contributor Author

Do you know if bsd tar will be available on all windows versions? Including windows servers?

Based on https://docs.microsoft.com/en-us/virtualization/community/team-blog/2017/20171219-tar-and-curl-come-to-windows, it was only added in Build 17063, so older versions of Windows won't have it.
I'm not sure if the Windows server will have it. From speaking with @ericsciple, the various npm packages for tar can sometimes be problematic.

The current behavior is that no self-hosted runners will work with actions/cache since it's expecting a GNU tar prepended to the Path, which is unique to our hosted runner images. This at least allows all self-hosted runners using newer versions of Windows to use this action.

@joshmgross joshmgross merged commit 3854a40 into master Dec 13, 2019
@joshmgross joshmgross deleted the joshmgross/windows-bsd-tar branch December 13, 2019 22:24
@1480c1
Copy link

1480c1 commented Dec 27, 2019

Would it be possible to do a 1.0.4 release with this in it? I am trying to set up self-hosted windows runners for a project, but it always fails to cache anything because of the --force-local option not being available on bsdtar and cache ignores the mingw-w64 tar I have first in PATH. I tried to do uses: actions/cache@master but it did not get the dist folder even though it got everything else.

@joshmgross
Copy link
Contributor Author

@1480c1 There will be a release soon with this change. In the meantime, if you fork the repository and run npm run release, you should be able to build and commit the dist folder and use that fork of the action.

@1480c1
Copy link

1480c1 commented Dec 27, 2019

Okay, thank you. Don't know much about npm yet so I wasn't sure how to solve the issue on my own.

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.

Fails on self-hosted Windows runner with "tar --force-local is not supported"

4 participants