You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a Sensor to trigger creation of some k8s objects pulled directly from a git repo, I expected GitArtifact to take the default branch if source.git.branch parameter was not set, but instead the trigger fails with the following error:
{"level":"error","ts":1728911591.502107,"logger":"argo-events.sensor","caller":"sensors/listener.go:364","msg":"Failed to execute a trigger","sensorName":"mySensor","error":"failed to fetch artifact, failed after retries: failed to checkout. err: reference not found","triggerName":"workflow-trigger-1","stacktrace":"github.com/argoproj/argo-events/sensors.(*SensorContext).triggerActions.func1\n\t/home/runner/work/argo-events/argo-events/sensors/listener.go:364"}
master seems to be hardcoded as the default here. The docs for GitArtifact are here.
Many many projects, especially new repos, use main as their default branch now, and the error is a little opaque to the average user, so it would be nice if it could include the specific reference that wasn't found.
If targeting the default branch isn't possible then I suggest the documentation should include something about how some combination of branch/tag/ref is recommended, and what the behaviour is by default if none are specified.
Edit: I'm aware that default branches are not strictly a git feature, but all the git tools I've ever used behave the same way - when asked to clone a repo from a URL, they always clone the default branch unless explicitly told otherwise.
The text was updated successfully, but these errors were encountered:
On a shallow read it looks like where branch, tag and ref are all unset, r.Clone() could be used in place of the current r.Fetch()/w.Checkout() path.
As far as I can see this would be fully backwards-compatible, the only affected users would have to be depending on master being the default for repos where master wasn't actually the default branch of their target remote. I'd expect very few of those exist since it wasn't documented!
Using a Sensor to trigger creation of some k8s objects pulled directly from a git repo, I expected
GitArtifact
to take the default branch ifsource.git.branch
parameter was not set, but instead the trigger fails with the following error:master
seems to be hardcoded as the default here. The docs forGitArtifact
are here.Many many projects, especially new repos, use
main
as their default branch now, and the error is a little opaque to the average user, so it would be nice if it could include the specific reference that wasn't found.If targeting the default branch isn't possible then I suggest the documentation should include something about how some combination of branch/tag/ref is recommended, and what the behaviour is by default if none are specified.
Edit: I'm aware that default branches are not strictly a git feature, but all the git tools I've ever used behave the same way - when asked to clone a repo from a URL, they always clone the default branch unless explicitly told otherwise.
The text was updated successfully, but these errors were encountered: