mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-14 20:03:42 +00:00
fix: stop pruning the cached action ref on refresh (#1312)
The action cache refresh fetched with `--prune` and the unqualified refspec `+<ref>:refs/runner/<hash>`. Git cannot map that ref back to a remote ref, so it deleted it on every other refresh. The first job after a branch or tag moved then failed with `cannot lock ref`, and a moved tag in a full clone could silently run its old commit. `--no-prune` fixes this and also overrides an inherited `fetch.prune`. Fixes: https://gitea.com/gitea/runner/issues/1311 Reviewed-on: https://gitea.com/gitea/runner/pulls/1312 Reviewed-by: Lunny Xiao <[email protected]> Reviewed-by: Zettat123 <[email protected]>
This commit is contained in:
1 parent
470969dc74
commit
42858c61df
7 files changed
+87
-5
No files matched your search
@@ -23,7 +23,7 @@ func testWorkflowDispatch(t *testing.T) {
|
||||
t.Fatalf("get default branch: %v", err)
|
||||
}
|
||||
inputs := map[string]string{"subject": "dispatch-input-value"}
|
||||
if err := waitForDispatch(ctx, api, repo, branch, inputs); err != nil {
|
||||
if err := waitForDispatch(ctx, api, repo, "dispatch.yml", branch, inputs); err != nil {
|
||||
t.Fatalf("dispatch workflow: %v", err)
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ func testWorkflowDispatch(t *testing.T) {
|
||||
}
|
||||
|
||||
// Gitea indexes workflows asynchronously after the Contents API commit.
|
||||
func waitForDispatch(ctx context.Context, api *GiteaAPI, repo, branch string, inputs map[string]string) error {
|
||||
func waitForDispatch(ctx context.Context, api *GiteaAPI, repo, workflow, branch string, inputs map[string]string) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Minute)
|
||||
defer cancel()
|
||||
|
||||
var lastErr error
|
||||
for {
|
||||
lastErr = api.DispatchWorkflow(ctx, repo, "dispatch.yml", branch, inputs)
|
||||
lastErr = api.DispatchWorkflow(ctx, repo, workflow, branch, inputs)
|
||||
if lastErr == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user