-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Newly added sparse checkout functionality is not cleaning up after itself #1475
Comments
Indeed. The working directory's path typically contains the workflow name, e.g. A solid work-around would be to scorch the worktree (if it exists), right before the A more surgical work-around would be to use a shell script like this: - shell: bash
run: |
if test true = "$(git config --type bool core.sparsecheckout)"
then
rm "$(git rev-parse --git-path info/sparse-checkout)" &&
git sparse-checkout disable
fi |
We are looking to use such a workaround in the interim, but it seems this is something that should be fixed here within actions/checkout, no? |
This caused CI issues for us so we had to remove sparse checkout |
I also ran into issues with this, two different workflows, one which uses sparse and one which doesn't. I ended up removing the contents of the directory prior to checkout to force a clean checkout every time. |
@dscho Hi! Do you have plans to fix this isuue? |
@aamagda time constraints force me to say "no". Having said that, if you can start implementing that (probably by specifically resetting the sparse checkout if none is desired), and verify that it works, I can take it from there. |
This should allow users to reuse existing folders when running `actions/checkout` where a previous run asked for a sparse checkout but the current run does not ask for a sparse checkout. This fixes actions#1475 Signed-off-by: Johannes Schindelin <[email protected]>
When a worktree is reused by actions/checkout and the first time sparse checkout was enabled, we need to ensure that the second time it is only a sparse checkout if explicitly asked for. Otherwise, we need to disable the sparse checkout so that a full checkout is the outcome of this Action. ## Details * If no `sparse-checkout` parameter is specified, disable it This should allow users to reuse existing folders when running `actions/checkout` where a previous run asked for a sparse checkout but the current run does not ask for a sparse checkout. This fixes #1475 There are use cases in particular with non-ephemeral (self-hosted) runners where an existing worktree (that has been initialized as a sparse checkout) is reused in subsequent CI runs (where `actions/checkout` is run _without_ any `sparse-checkout` parameter). In these scenarios, we need to make sure that the sparse checkout is disabled before checking out the files. ### Also includes: * npm run build * ci: verify that an existing sparse checkout can be made unsparse * Added a clarifying comment about test branches. * `test-proxy` now uses newly-minted `test-ubuntu-git` container image from ghcr.io --------- Signed-off-by: Johannes Schindelin <[email protected]> Co-authored-by: John Wesley Walker III <[email protected]>
Assuming v4.1.2 works when explicitly setting it, I am still having the same issue with v4.1.2 on a self-hosted server |
@justin-newman could you verify in the logs that the |
Yes, it is doing that |
@justin-newman can you find out whether that command simply does not work in your setup? I am somewhat surprised to read that it was called yet did not fix the problem. |
I can confirm the same issue on our self hosted runner with version 4.1.6. The sparse checkout disable is called |
If I add another step in the action where I run |
I can confirm that this is still an issue.
... even tho the action reports the following:
But apparently this
|
This is the current way to fix this issue since newer versions of git require GitHub Authentication, and I'm not usually logged in to my GitHub account on my production machines. (hello world 🙄) |
Ahh, I thought the Git version shipped with Debian is too old, not too new, but that's very interesting to hear. |
Care to go into more details? Is this because the worktree is sparsely-checked out and it's a partial clone and the command needs to fetch Git objects in order to turn the sparse checkout into a full one? If that is the case, I really do not understand because the sparse checkout is disabled after the authentication is set up. Puzzled! |
Ahh, I think the authentication problem isn't really the issue here, since it only happens when I try to manually execute
And I can't tell you why authentication would be required. |
Thanks @dscho for contributing #1369 . We have started using it and noticed the following issue
repo-a
/.github/workflows/workflow-a.yml
running just the above works as expected. But consider another workflow in the same repo
repo-a
/.github/workflows/workflow-b.yml
When running
workflow-a
, then workflowworkflow-b
,workflow-b
will not find any files in./not-src
.This is because workflow
workflow-b
runs in the same _work directory asworkflow-a
. On the first run ofworkflow-a
, we have polluted the repo in a way this action doesn't know about (and thus can't clean up).Notice that, even in
workflow-b
:git config --list
will showcore.sparseCheckout true
git sparse-checkout list
will still include the listed pathsand a simple
ls
will only show the sparse directories forworkflow-a
It seems that - similar to the auth cleanup (and other pre-run steps) this action does - we need to disable sparse checkout in the
pre
steps of this actionNote: this is likely only an issue for self-hosted runners which dont get the same cleaning/re-init process github-hosted runners get
Similar-ish issue to recently reported 47fbe2d (for submodules, instead of sparse checkout). @megamanics
The text was updated successfully, but these errors were encountered: