fix: stop creation of branch called HEAD during fetch #1250

Merged
mfenniak merged 1 commit from aahlenst/runner:ambiguous-head into main 2026-01-03 04:25:34 +00:00
Member

When cloning a repository or updating the existing clone, Forgejo Runner performs a fetch. The ref spec HEAD:refs/heads/HEAD motivates go-git to create a local branch called HEAD. Consequently, HEAD becomes ambiguous and git rightfully complains about it (warning: refname 'HEAD' is ambiguous.).

  • bug fixes
    • PR: fix: stop creation of branch called HEAD during fetch
When cloning a repository or updating the existing clone, Forgejo Runner performs a fetch. The ref spec `HEAD:refs/heads/HEAD` motivates go-git to create a local branch called `HEAD`. Consequently, `HEAD` becomes ambiguous and `git` rightfully complains about it (`warning: refname 'HEAD' is ambiguous.`). <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1250): <!--number 1250 --><!--line 0 --><!--description Zml4OiBzdG9wIGNyZWF0aW9uIG9mIGJyYW5jaCBjYWxsZWQgSEVBRCBkdXJpbmcgZmV0Y2g=-->fix: stop creation of branch called HEAD during fetch<!--description--> <!--end release-notes-assistant-->
aahlenst force-pushed ambiguous-head from 915b5c0a60
Some checks failed
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / build and test (pull_request) Has been cancelled
checks / integration tests (docker-stable) (pull_request) Has been cancelled
checks / validate mocks (pull_request) Has been cancelled
checks / validate pre-commit-hooks file (pull_request) Has been cancelled
checks / integration tests (docker-latest) (pull_request) Has been cancelled
checks / runner exec tests (pull_request) Has been cancelled
checks / runner integration tests (pull_request) Has been cancelled
Integration tests for the release process / release-simulation (pull_request) Successful in 5m57s
to b28f25256a
All checks were successful
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / validate pre-commit-hooks file (pull_request) Successful in 1m8s
checks / validate mocks (pull_request) Successful in 1m13s
checks / build and test (pull_request) Successful in 3m55s
checks / runner exec tests (pull_request) Successful in 33s
checks / runner integration tests (pull_request) Successful in 6m22s
checks / integration tests (docker-latest) (pull_request) Successful in 11m26s
checks / integration tests (docker-stable) (pull_request) Successful in 13m20s
2025-12-30 14:11:30 +00:00
Compare
viceice left a comment
Owner

I think this needs a unit test

I think this needs a unit test
mfenniak approved these changes 2025-12-30 21:54:19 +00:00
mfenniak left a comment
Owner

Hm... it's a weird thing to unit test "not doing something that was always wrong". 🤔 I'm OK with merging this without a test because of that, but I'll hold onto it and let @viceice disagree if he's firm on it.

I tracked back when this was added (in act) and there was no rationale or explanation for it... I vaguely think it might have occurred because refs/* is supported by go-git and treats the wildcard as matching a path separator, but git doesn't, so there may not have been an understanding that refs/* actually fetches all remote refs.

Hm... it's a weird thing to unit test "not doing something that was always wrong". 🤔 I'm OK with merging this without a test because of that, but I'll hold onto it and let @viceice disagree if he's firm on it. I tracked back [when this was added](https://github.com/nektos/act/pull/679) (in act) and there was no rationale or explanation for it... I vaguely think it might have occurred because `refs/*` is supported by go-git and treats the wildcard as matching a path separator, but git doesn't, so there may not have been an understanding that `refs/*` actually fetches all remote refs.
Owner

I mean we should add a unit test to ensure it'll not break again

I mean we should add a unit test to ensure it'll not break again
aahlenst force-pushed ambiguous-head from b28f25256a
All checks were successful
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / validate pre-commit-hooks file (pull_request) Successful in 1m8s
checks / validate mocks (pull_request) Successful in 1m13s
checks / build and test (pull_request) Successful in 3m55s
checks / runner exec tests (pull_request) Successful in 33s
checks / runner integration tests (pull_request) Successful in 6m22s
checks / integration tests (docker-latest) (pull_request) Successful in 11m26s
checks / integration tests (docker-stable) (pull_request) Successful in 13m20s
to 9b835e0a4a
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / integration tests (docker-latest) (pull_request) Failing after 17s
checks / validate mocks (pull_request) Successful in 36s
checks / validate pre-commit-hooks file (pull_request) Successful in 38s
checks / build and test (pull_request) Successful in 2m26s
checks / runner exec tests (pull_request) Successful in 32s
checks / runner integration tests (pull_request) Successful in 5m14s
checks / integration tests (docker-stable) (pull_request) Successful in 9m59s
2026-01-02 10:28:36 +00:00
Compare
The test error is environmental and unrelated, it needs a re-run https://code.forgejo.org/forgejo/runner/actions/runs/14190/jobs/2/attempt/1#jobstep-3-19

I don't see how that can be tested with certainty: the content of this list can be incorrect in ways that won't trigger an error.

I don't see how that can be tested with certainty: the content of this list can be incorrect in ways that won't trigger an error.
aahlenst force-pushed ambiguous-head from 9b835e0a4a
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / integration tests (docker-latest) (pull_request) Failing after 17s
checks / validate mocks (pull_request) Successful in 36s
checks / validate pre-commit-hooks file (pull_request) Successful in 38s
checks / build and test (pull_request) Successful in 2m26s
checks / runner exec tests (pull_request) Successful in 32s
checks / runner integration tests (pull_request) Successful in 5m14s
checks / integration tests (docker-stable) (pull_request) Successful in 9m59s
to efe86f5ac3
All checks were successful
checks / validate mocks (pull_request) Successful in 25s
checks / validate pre-commit-hooks file (pull_request) Successful in 33s
checks / build and test (pull_request) Successful in 1m54s
checks / runner exec tests (pull_request) Successful in 24s
checks / runner integration tests (pull_request) Successful in 5m8s
checks / integration tests (docker-stable) (pull_request) Successful in 10m8s
checks / integration tests (docker-latest) (pull_request) Successful in 9m30s
issue-labels / release-notes (pull_request_target) Successful in 28s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 7s
cascade / forgejo (pull_request_target) Successful in 2m10s
2026-01-02 11:30:23 +00:00
Compare
Author
Member

There is now a test: 9b835e0a4a..efe86f5ac3

There is now a test: https://code.forgejo.org/forgejo/runner/compare/9b835e0a4aef302d417f4c0db7ae5c1e626f9c36..efe86f5ac36892d742f0399df9d1fb4d3b9054c2
viceice approved these changes 2026-01-02 12:14:57 +00:00
viceice left a comment
Owner

ci failure seems to be an upstream docker debian apt repo issue 🤔

ci failure seems to be an upstream docker debian apt repo issue 🤔
Author
Member

@viceice It looks like a DNS resolution or caching problem. I can access the repository.

@viceice It looks like a DNS resolution or caching problem. I can access the repository.

The unrelated error is due to LXC caching and persists.

https://code.forgejo.org/forgejo/runner/actions/runs/14194/jobs/2/attempt/2

It will stay until the cache expires. To resolve it immediately the LXC container of this runner can be stopped and restarted. It will discard the cache.

https://code.forgejo.org/forgejo/runner/src/branch/main/examples/lxc-systemd#how-it-works

lxc_container_run $draft apt-get update -qq

The unrelated error is due to LXC caching and persists. https://code.forgejo.org/forgejo/runner/actions/runs/14194/jobs/2/attempt/2 It will stay until the cache expires. To resolve it immediately the LXC container of this runner can be stopped and restarted. It will discard the cache. https://code.forgejo.org/forgejo/runner/src/branch/main/examples/lxc-systemd#how-it-works https://code.forgejo.org/forgejo/lxc-helpers/src/commit/5bb6e6d7b4791a579197cad809e79672462535f9/lxc-helpers-lib.sh#L400
Owner

@limiting-factor wrote in #1250 (comment):

The unrelated error is due to LXC caching and persists.

https://code.forgejo.org/forgejo/runner/actions/runs/14194/jobs/2/attempt/2

It will stay until the cache expires. To resolve it immediately the LXC container of this runner can be stopped and restarted. It will discard the cache.

https://code.forgejo.org/forgejo/runner/src/branch/main/examples/lxc-systemd#how-it-works

forgejo/lxc-helperslxc-helpers-lib.sh
Line 400 in forgejo/lxc-helpers@5bb6e6d
lxc_container_run $draft apt-get update -qq

will restart it in a few minutes

@limiting-factor wrote in https://code.forgejo.org/forgejo/runner/pulls/1250#issuecomment-71459: > The unrelated error is due to LXC caching and persists. > > https://code.forgejo.org/forgejo/runner/actions/runs/14194/jobs/2/attempt/2 > > It will stay until the cache expires. To resolve it immediately the LXC container of this runner can be stopped and restarted. It will discard the cache. > > https://code.forgejo.org/forgejo/runner/src/branch/main/examples/lxc-systemd#how-it-works > > [forgejo/lxc-helpers](https://code.forgejo.org/forgejo/lxc-helpers/) – [lxc-helpers-lib.sh](https://code.forgejo.org/forgejo/lxc-helpers/src/commit/5bb6e6d7b4791a579197cad809e79672462535f9/lxc-helpers-lib.sh#L400) > Line 400 in [forgejo/lxc-helpers@5bb6e6d](https://code.forgejo.org/forgejo/lxc-helpers/src/commit/5bb6e6d7b4791a579197cad809e79672462535f9) > ` lxc_container_run $draft apt-get update -qq ` will restart it in a few minutes
Owner

didn't worked. it seems something between runner and docker repo is broken 🤔

didn't worked. it seems something between runner and docker repo is broken 🤔
Owner

# Derived from Docker's official debian installation documentation: https://docs.docker.com/engine/install/debian/#install-using-the-repository
# Add Docker's official GPG key:
apt-get update
apt-get install -y -qq ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
apt-get update
apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

https://code.forgejo.org/forgejo/runner/src/commit/1a586f3dfae1766319aefcf82e0f8bd611e4741a/.forgejo/install-docker.sh#L16-L34
Owner
there is no containerd 2.2.1 at https://download.docker.com/linux/debian/dists/bookworm/pool/stable/amd64/
Owner
also missing on trixie https://download.docker.com/linux/debian/dists/trixie/pool/stable/amd64/
Owner
https://forums.docker.com/t/installation-issues-on-ubuntu/150736
Owner
should be back in ~20min https://github.com/containerd/containerd/issues/12741#issuecomment-3705600052
Owner

running 🥳

running 🥳
Contributor

cascading-pr updated at actions/setup-forgejo#804

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/804
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1250
No description provided.