fix(jobparser): evaluating matrix values within runs-on references first matrix value only #1307

Merged
mfenniak merged 1 commit from mfenniak/forgejo-runner:fix-matrix-eval-on-runs-on into main 2026-01-18 17:27:09 +00:00
Owner

runs-on: [ abc, ${{ matrix.dimension }} ] is evaluating the first time the the job parser goes through the matrix, and removing the evaluation variable. For the next matrix value, there's no expression left to evaluate.

Regression caused by #1194. During development, it was assumed that cloning yaml.Node would create an independent node -- which it does when the data is stored in the Value fields of the yaml.Node. But when runs-on is a sequence, the values are stored in an array of pointers which causes a clone to share internal state with the original value. Unfortunately this failed to trigger a regression test.

This is currently broken in Forgejo 14.0.0 - 14.0.1, which will require this to be merged, a runner to be released, the runner to be upgraded in Forgejo, and a Forgejo release with the regression fixed.

  • bug fixes
    • PR: fix(jobparser): evaluating matrix values within runs-on references first matrix value only
`runs-on: [ abc, ${{ matrix.dimension }} ]` is evaluating the first time the the job parser goes through the matrix, and removing the evaluation variable. For the next matrix value, there's no expression left to evaluate. Regression caused by https://code.forgejo.org/forgejo/runner/pulls/1194. During development, it was assumed that cloning `yaml.Node` would create an independent node -- which it does when the data is stored in the `Value` fields of the `yaml.Node`. But when `runs-on` is a sequence, the values are stored in an array of pointers which causes a clone to share internal state with the original value. Unfortunately this failed to trigger a regression test. This is currently broken in Forgejo 14.0.0 - 14.0.1, which will require this to be merged, a runner to be released, the runner to be upgraded in Forgejo, and a Forgejo release with the regression fixed. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1307): <!--number 1307 --><!--line 0 --><!--description Zml4KGpvYnBhcnNlcik6IGV2YWx1YXRpbmcgbWF0cml4IHZhbHVlcyB3aXRoaW4gcnVucy1vbiByZWZlcmVuY2VzIGZpcnN0IG1hdHJpeCB2YWx1ZSBvbmx5-->fix(jobparser): evaluating matrix values within runs-on references first matrix value only<!--description--> <!--end release-notes-assistant-->
mfenniak force-pushed fix-matrix-eval-on-runs-on from b11eea9bee
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / validate mocks (pull_request) Successful in 40s
checks / validate pre-commit-hooks file (pull_request) Successful in 41s
checks / Build Forgejo Runner (pull_request) Successful in 46s
checks / Build unsupported platforms (pull_request) Successful in 22s
checks / runner exec tests (pull_request) Successful in 34s
checks / integration tests (docker-latest) (pull_request) Failing after 8m50s
checks / integration tests (docker-stable) (pull_request) Failing after 10m50s
to fd2360b3b4
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 / Build Forgejo Runner (pull_request) Successful in 25s
checks / validate mocks (pull_request) Successful in 28s
checks / validate pre-commit-hooks file (pull_request) Successful in 31s
checks / Build unsupported platforms (pull_request) Successful in 19s
checks / runner exec tests (pull_request) Successful in 35s
checks / integration tests (docker-latest) (pull_request) Successful in 8m24s
checks / integration tests (docker-stable) (pull_request) Successful in 12m52s
2026-01-18 03:23:06 +00:00
Compare
viceice left a comment
Owner

otherwise LGTM

btw: which label is used by the runner to decide the execution mode? 🤔 eg: I set lxc and docker, does it run on first label defined?

we need to update the docs to be node v24 here
https://forgejo.org/docs/next/admin/actions/#lxc

otherwise LGTM btw: which label is used by the runner to decide the execution mode? 🤔 eg: I set lxc and docker, does it run on first label defined? we need to update the docs to be node v24 here https://forgejo.org/docs/next/admin/actions/#lxc
@ -283,0 +292,4 @@
bytes, err := yaml.Marshal(node)
if err != nil {
return nil, fmt.Errorf("failed to marshal node: %w", err)
} else if node.Kind == 0 {
Owner

shouldn't this come before the marshall to save call?

shouldn't this come before the marshall to save call?
mfenniak force-pushed fix-matrix-eval-on-runs-on from fd2360b3b4
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 / Build Forgejo Runner (pull_request) Successful in 25s
checks / validate mocks (pull_request) Successful in 28s
checks / validate pre-commit-hooks file (pull_request) Successful in 31s
checks / Build unsupported platforms (pull_request) Successful in 19s
checks / runner exec tests (pull_request) Successful in 35s
checks / integration tests (docker-latest) (pull_request) Successful in 8m24s
checks / integration tests (docker-stable) (pull_request) Successful in 12m52s
to 10384dd6cc
All checks were successful
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / Build Forgejo Runner (pull_request) Successful in 26s
checks / validate pre-commit-hooks file (pull_request) Successful in 32s
checks / validate mocks (pull_request) Successful in 35s
checks / Build unsupported platforms (pull_request) Successful in 21s
checks / runner exec tests (pull_request) Successful in 31s
checks / integration tests (docker-latest) (pull_request) Successful in 8m51s
checks / integration tests (docker-stable) (pull_request) Successful in 10m45s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 1m8s
2026-01-18 16:16:40 +00:00
Compare
Author
Owner

@viceice wrote in #1307 (comment):

btw: which label is used by the runner to decide the execution mode? 🤔 eg: I set lxc and docker, does it run on first label defined?

The first one in the runs-on list is used.

@viceice wrote in https://code.forgejo.org/forgejo/runner/pulls/1307#issuecomment-74142: > btw: which label is used by the runner to decide the execution mode? :thinking: eg: I set lxc and docker, does it run on first label defined? The first one in the `runs-on` list is used.
mfenniak deleted branch fix-matrix-eval-on-runs-on 2026-01-18 17:27:10 +00:00
viceice approved these changes 2026-01-18 19:00:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!1307
No description provided.