1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-05 18:40:59 +00:00
forgejo-runner/act/runner/testdata
Mathieu Fenniak 165b44deec
fix: data race in 'runs-on' expressions causes incorrect job labels during execution (#871)
A job with a `runs-on` that references matrix variables will not run with the expected labels.  eg.

```
jobs:
  matrix-runs-on:
    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-20.04]
    runs-on: ${{ matrix.os }}
    steps:
      ...
```
Due to shared mutated state, both jobs that this generates will (w/ a race condition) either run with the `ubuntu-latest` or `ubuntu-20.04`, but rarely (never observed) with the expected outcome of running on both labels.

`EvaluateYamlNode` is used to evaluate expressions in the `runs-on` field in the context of the current running job, but mutating an object shared between multiple concurrent jobs (in matrix evaluation).  This results in the evaluation results from one job spilling into another and corrupting their `runs-on` labels.

```
==================
WARNING: DATA RACE
Write at 0x00c00047e0b0 by goroutine 1739:
  reflect.typedmemmove()
      /.../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.6.linux-amd64/src/runtime/mbarrier.go:213 +0x0
  reflect.Value.Set()
      /.../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.6.linux-amd64/src/reflect/value.go:2062 +0x184
  gopkg.in/yaml%2ev3.(*decoder).unmarshal()
      /.../go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/decode.go:493 +0x7b4
  gopkg.in/yaml%2ev3.(*Node).Decode()
      /.../go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/yaml.go:149 +0x355
  code.forgejo.org/forgejo/runner/v9/act/runner.expressionEvaluator.EvaluateYamlNode()
      /.../forgejo-runner/act/runner/expression.go:372 +0x7a
  code.forgejo.org/forgejo/runner/v9/act/runner.(*expressionEvaluator).EvaluateYamlNode()
      <autogenerated>:1 +0x6b
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).runsOnPlatformNames()
      /.../forgejo-runner/act/runner/run_context.go:1019 +0x2af
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).runsOnImage()
      /.../forgejo-runner/act/runner/run_context.go:1002 +0x772
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).platformImage()
      /.../forgejo-runner/act/runner/run_context.go:1032 +0x77
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).isEnabled()
      /.../forgejo-runner/act/runner/run_context.go:1069 +0x3c7
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).Executor.func1()
      /.../forgejo-runner/act/runner/run_context.go:964 +0x4b
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.1()
      /.../forgejo-runner/act/runner/runner.go:223 +0x271
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.2.1()
      /.../forgejo-runner/act/common/executor.go:107 +0x61
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.2.gowrap1()
      /.../forgejo-runner/act/common/executor.go:109 +0x4f

Previous read at 0x00c00047e0b0 by goroutine 1742:
  code.forgejo.org/forgejo/runner/v9/act/model.(*Job).RunsOn()
      /.../forgejo-runner/act/model/workflow.go:361 +0x3c4
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).runsOnImage()
      /.../forgejo-runner/act/runner/run_context.go:991 +0x57a
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).platformImage()
      /.../forgejo-runner/act/runner/run_context.go:1032 +0x77
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).isEnabled()
      /.../forgejo-runner/act/runner/run_context.go:1069 +0x3c7
  code.forgejo.org/forgejo/runner/v9/act/runner.(*RunContext).Executor.func1()
      /.../forgejo-runner/act/runner/run_context.go:964 +0x4b
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.1()
      /.../forgejo-runner/act/runner/runner.go:223 +0x271
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.2.1()
      /.../forgejo-runner/act/common/executor.go:107 +0x61
  code.forgejo.org/forgejo/runner/v9/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.2.gowrap1()
      /.../forgejo-runner/act/common/executor.go:109 +0x4f
...
==================
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/871): <!--number 871 --><!--line 0 --><!--description Zml4OiBkYXRhIHJhY2UgaW4gJ3J1bnMtb24nIGV4cHJlc3Npb25zIGNhdXNlcyBpbmNvcnJlY3Qgam9iIGxhYmVscyBkdXJpbmcgZXhlY3V0aW9u-->fix: data race in 'runs-on' expressions causes incorrect job labels during execution<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/871
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-08-16 20:44:40 +00:00
..
.github/workflows fix: update reusable workflow input handling (#834) 2025-08-11 21:10:44 +00:00
act-composite-env-test chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
actions feat: support actions with 'using: node24' (#847) 2025-08-11 18:53:48 +00:00
actions-environment-and-context-tests chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
basic fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
checkout chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
commands Update images, fix extrapath (#723) 2021-06-10 23:12:05 +00:00
composite-fail-with-output fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
container-hostname chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
defaults-run Support setting shell via defaults.run (#343) 2020-08-28 11:52:25 -07:00
dir with spaces Add proper support for working-directory & fix command builder (#772) 2021-08-10 19:40:20 +00:00
do-not-leak-step-env-in-composite refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
docker-action-custom-path chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
ensure-post-steps chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
env-and-path Fixes #1387 (#1388) 2022-10-18 22:27:28 +00:00
environment-files refactor: share UpdateFromEnv logic (#1457) 2022-12-06 16:19:27 +00:00
environment-files-parser-bug refactor: share UpdateFromEnv logic (#1457) 2022-12-06 16:19:27 +00:00
environment-variables fix: handle env-vars case sensitive (#1493) 2022-12-07 15:31:33 +00:00
evalenv Made env interpolated instead of evaluated. (#1222) 2022-07-27 19:46:04 +00:00
evalmatrix fix: processing of strategy.matrix.include (#1200) 2022-06-20 15:33:07 -07:00
evalmatrix-merge-array fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrix-merge-map fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrixneeds fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrixneeds2 fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
fail chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
GITHUB_ENV-use-in-env-ctx chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
GITHUB_STATE chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
if-env-act Test: env.ACT in if condition of the workflow (#965) 2022-01-25 09:27:27 -08:00
if-expressions chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
input-from-cli Input (#1524) 2023-01-13 19:28:17 +00:00
inputs-via-env-context chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
issue-104 chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
issue-122 chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
issue-141 chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
issue-597 test: fix failures caused by node24 usage in hello-world-javascript-action [skip cascade] (#830) 2025-08-10 12:03:50 +00:00
issue-598 test: fix failures caused by node24 usage in hello-world-javascript-action [skip cascade] (#830) 2025-08-10 12:03:50 +00:00
issue-1595 fix: tolerate workflow that needs a missing job (#1595) (#1619) 2023-02-16 16:41:59 +00:00
job-container chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
job-container-invalid-credentials chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
job-container-non-root fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
job-needs-context-contains-result feat: Support "result" on "needs" context. (#1497) 2022-12-19 08:37:53 +00:00
job-nil-step fix: panic if a step in a job is nil (#1145) 2022-05-12 19:23:34 +00:00
job-status-check fix: continue jobs + steps after failure (#840) 2021-12-08 20:57:42 +00:00
local-action-docker-url chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
local-action-dockerfile chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
local-action-fails-schema-validation fix: log the URL of the action when it fails schema validation (#810) 2025-08-04 13:20:22 +00:00
local-action-js feat: support actions with 'using: node24' (#847) 2025-08-11 18:53:48 +00:00
local-action-via-composite-dockerfile chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
localdockerimagetest_ chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
mask-values chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
matrix fix #108 - ensure container names are unique for matrix runs 2020-03-04 16:24:14 -08:00
matrix-exitcode fix: preserve job result state in case of failure (#1519) 2023-01-10 21:31:12 +00:00
matrix-include-exclude Fixes include when using matrix and strategy build. (#415) 2020-12-08 10:13:07 -08:00
matrix-runs-on fix: data race in 'runs-on' expressions causes incorrect job labels during execution (#871) 2025-08-16 20:44:40 +00:00
matrix-shell fix: data race condition causing incorrect shell on a task step if it referenced a matrix variable (#865) 2025-08-15 21:10:53 +00:00
matrix-with-user-inclusions feat: specify matrix on command line (#1675) 2023-03-19 17:25:55 +00:00
mysql-service-container-premature-terminate feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
mysql-service-container-with-health-check feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
networking test: use ping to improve network test (#2266) 2025-06-03 15:46:19 +03:00
nix-prepend-path feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
no-panic-on-invalid-composite-action chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
node chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
non-existent-action Fix: regression run after failure (#971) 2022-01-27 16:20:44 +00:00
outputs Don't interpolate joboutputs, before job is done (#894) 2021-11-24 15:49:08 +00:00
parallel test: fix failures caused by node24 usage in hello-world-javascript-action [skip cascade] (#830) 2025-08-10 12:03:50 +00:00
path-handling chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
pull-request fix: keep path to event json file in composite actions (#1428) 2022-11-16 17:00:49 +00:00
python chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
remote-action-composite-action-ref chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
remote-action-composite-js-pre-with-defaults chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
remote-action-docker chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
remote-action-js chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
remote-action-js-node-user chore: replace docker hub with code.forgejo.org (#799) 2025-08-02 21:55:57 +00:00
runs-on Add support for runs-on array form (closes #146) (#155) 2020-03-16 14:58:10 -07:00
secrets feat: load every environment from --env-file to workflow (#184) 2020-04-17 10:04:40 -07:00
services feat: wait for services to be healthy before starting a job (#805) 2025-08-07 04:36:26 +00:00
services-with-container fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
set-env-new-env-file-per-step refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
set-env-step-env-override refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
shells fix!: fallback to sh if bash does not exist 2025-07-12 19:01:14 +02:00
skipjob fix: do not fail the job when if: false (#172) 2025-07-07 12:11:57 +00:00
skipstep fix: do not fail the job when if: false (#172) 2025-07-07 12:11:57 +00:00
steps-context Add more steps context support (#887) 2021-11-27 17:55:26 +00:00
stepsummary feat: log parsed commands and step summary (#824) 2025-08-07 21:03:44 +00:00
tool-cache fix: allow overriding RUNNER_TOOL_CACHE from the config file (#178) 2025-07-13 21:55:02 +00:00
uses-action-with-pre-and-post-step chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-and-run-in-one-step chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-composite chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-composite-check-for-input-collision fix: composite action input pollution (#818) 2025-08-10 16:24:19 +00:00
uses-composite-check-for-input-in-if-uses fix: composite action input pollution (#818) 2025-08-10 16:24:19 +00:00
uses-composite-check-for-input-shadowing fix: composite action input pollution (#818) 2025-08-10 16:24:19 +00:00
uses-composite-with-error chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-composite-with-inputs chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-composite-with-pre-and-post-steps chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-docker-url fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
uses-github-empty Throw an error if the steps has a invalid uses directive (#500) 2021-01-23 08:07:28 -08:00
uses-github-full-sha fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
uses-github-noref chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-github-path chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-github-root chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-github-short-sha fix(ci): use code.forgejo.org instead of the docker hub (#762) 2025-07-29 15:37:16 +00:00
uses-nested-composite chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-sh chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-sh-test-action-path chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
uses-workflow chore: enable test cases for reusable workflows 2025-08-15 09:20:19 +02:00
uses-workflow-defaults fix: prevent unintended input replacement in reusable workflows with workflow_dispatch when using workflow_call (#833) 2025-08-10 19:37:14 +00:00
windows-add-env chore(tests): add coverage for ./pkg/runner (#202) 2025-07-28 06:18:46 +00:00
windows-prepend-path fix: environment handling windows (host mode) (#1732) 2023-04-18 18:09:57 +00:00
windows-shell-cmd feat: cmd support for windows (#1941) 2023-08-08 15:44:25 +00:00
workdir Make sure working directory is respected when configured from matrix (#1686) 2023-03-28 12:24:03 +00:00
workflow_call_inputs Allow inputs for workflow_calls (#1845) 2023-06-27 17:32:04 +00:00
workflow_dispatch Mapping workflow_dispatch inputs into the Expression inputs context (#1363) 2022-10-17 16:25:26 +00:00
workflow_dispatch-scalar fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00
workflow_dispatch-scalar-composite-action fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00
workflow_dispatch_no_inputs_mapping fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00