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

Clean the repository cache if it is in incomplete state #595

Merged
merged 2 commits into from
Apr 6, 2021

Conversation

lufia
Copy link
Contributor

@lufia lufia commented Apr 2, 2021

Go-git v5 has PlainCloneContext. It accepts a context.Context at first argument then it cleanup the directory if any error is occurred in cloning the repository.

ref #538 (comment)

Seems like this issue occurs when actions cache gets corrupted.

Tests

I've tested with a workflow described in #538 (comment)

% act -n workflow_dispatch
*DRYRUN* [java-test/build] 🚀  Start image=catthehacker/ubuntu:act-latest
*DRYRUN* [java-test/build]   🐳  docker run image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
*DRYRUN* [java-test/build] ⭐  Run Set up JDK 1.11
*DRYRUN* [java-test/build]   ☁  git clone 'https://github.com/actions/setup-java' # ref=v1
// Interrupt here
^C*DRYRUN* [java-test/build] Unable to clone https://github.com/actions/setup-java refs/heads/v1: context canceled
*DRYRUN* [java-test/build]   ❌  Failure - Set up JDK 1.11
Error: context canceled

% act -n workflow_dispatch
*DRYRUN* [java-test/build] 🚀  Start image=catthehacker/ubuntu:act-latest
*DRYRUN* [java-test/build]   🐳  docker run image=catthehacker/ubuntu:act-latest platform=linux/amd64 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
*DRYRUN* [java-test/build] ⭐  Run Set up JDK 1.11
*DRYRUN* [java-test/build]   ☁  git clone 'https://github.com/actions/setup-java' # ref=v1
*DRYRUN* [java-test/build]   ✅  Success - Set up JDK 1.11

@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #595 (5766f14) into master (465fbba) will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #595      +/-   ##
==========================================
+ Coverage   49.20%   49.35%   +0.15%     
==========================================
  Files          23       23              
  Lines        2321     2320       -1     
==========================================
+ Hits         1142     1145       +3     
+ Misses       1052     1049       -3     
+ Partials      127      126       -1     
Impacted Files Coverage Δ
pkg/common/executor.go 44.87% <100.00%> (+4.36%) ⬆️
pkg/common/git.go 63.79% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 465fbba...5766f14. Read the comment docs.

@lufia lufia marked this pull request as ready for review April 6, 2021 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants