1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix: allow overriding RUNNER_TOOL_CACHE from the config file (#178)

- rc.getToolCache(ctx) is used to figure out RUNNER_TOOL_CACHE and  returns RUNNER_TOOL_CACHE if it is found in the runner config, e.g.
  ```yaml
  container:
    env:
	  RUNNER_TOOL_CACHE: /srv/toolcache
  ```
- store the value in the new `toolCache` data member for containers,  in the same way it is done for host
- GetRunnerContext for containers return `toolCache` instead of a  hard coded string
- add integration test

Closes forgejo/runner#184

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/178
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-13 21:55:02 +00:00 committed by earl-warren
parent d2f668c880
commit 6620cc1d18
9 changed files with 39 additions and 9 deletions

View file

@ -218,7 +218,8 @@ func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config
}
type TestConfig struct {
LocalRepositories map[string]string `yaml:"local-repositories"`
LocalRepositories map[string]string `yaml:"local-repositories,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
}
func TestRunEvent(t *testing.T) {
@ -314,6 +315,7 @@ func TestRunEvent(t *testing.T) {
{workdir, "set-env-step-env-override", "push", "", platforms, secrets},
{workdir, "set-env-new-env-file-per-step", "push", "", platforms, secrets},
{workdir, "no-panic-on-invalid-composite-action", "push", "jobs failed due to invalid action", platforms, secrets},
{workdir, "tool-cache", "push", "", platforms, secrets},
// services
{workdir, "services", "push", "", platforms, secrets},
@ -349,6 +351,7 @@ func TestRunEvent(t *testing.T) {
}
}
}
config.Env = testConfig.Env
}
table.runTest(ctx, t, config)