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

Adding fix for tar exiting with code 1 issue #1108

Merged
merged 15 commits into from
Jun 6, 2022

Conversation

kotewar
Copy link
Contributor

@kotewar kotewar commented Jun 1, 2022

Fix for actions/cache#689

The issue is mainly happening when ~/ (i.e. the home directory) is used in the path for caching. Internally we use a sub-directory of home directory as our temporary storage for our tar to get created. So if our temporary folder is a sub-directory of path that needs to be cached, we fall into an issue where the tar cannot tar itself and finds a change in its contents while it is trying to tar, which leads to the program throwing the following error (as mentioned in the issue) -

Post job cleanup.
/usr/bin/tar --posix --use-compress-program zstd -T0 -cf cache.tzst -P -C /home/runner/work/xxx/xxx--files-from manifest.txt
/usr/bin/tar: ../../../work/_temp/6483fbb9-3579-4fb0-a582-3316b336d5a9/cache.tzst: file changed as we read it
Warning: Tar failed with error: The process '/usr/bin/tar' failed with exit code 1

To fix this, we've added an explicit exclude for the tar file in the compression command.

Also some of our package-lock.json files are outdated, have committed them as well.

@kotewar kotewar marked this pull request as ready for review June 3, 2022 11:25
@kotewar kotewar requested review from a team as code owners June 3, 2022 11:25
@kotewar
Copy link
Contributor Author

kotewar commented Jun 3, 2022

The test run for verifying the same is present here - https://github.com/kotewar/learning-actions/runs/6751011211?check_suite_focus=true

Copy link
Contributor

@vsvipul vsvipul left a comment

Choose a reason for hiding this comment

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

Please remove non cache related package-lock.json changes.

@anuragc617
Copy link
Contributor

The test run for verifying the same is present here - https://github.com/kotewar/learning-actions/actions/runs/2434060218

I tried to run the same workflow for cache@v3, and it is still passing for me. Are you sure that you have tested the correct scenario?

@kotewar
Copy link
Contributor Author

kotewar commented Jun 6, 2022

@anuragc617 Updated the URL with correct test link. Please refer - https://github.com/kotewar/learning-actions/runs/6751011211?check_suite_focus=true

Moreover, the error only comes when there's a cache miss in ubuntu-latest.

For MacOS and Windows, we'll have to open separate issues as there are files in home directory of the respective OS which our tar program cannot access.

@anuragc617
Copy link
Contributor

Yes, @kotewar my bad restore has happened for ubuntu-latest.

@kotewar
Copy link
Contributor Author

kotewar commented Jun 6, 2022

@anuragc617 are you good with the changes?

@kotewar kotewar merged commit b5f31bb into main Jun 6, 2022
@kotewar kotewar deleted the users/kotewar/fix-tar-exit-with-code-1 branch June 6, 2022 09:30
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