1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

feat: Host environment (#1293)

This commit is contained in:
ChristopherHX 2022-11-16 22:29:45 +01:00 committed by GitHub
parent 865c4556e0
commit ab1deb20a5
38 changed files with 1395 additions and 187 deletions

View file

@ -162,13 +162,12 @@ func mergeEnv(ctx context.Context, step step) {
mergeIntoMap(env, rc.GetEnv())
}
if (*env)["PATH"] == "" {
(*env)["PATH"] = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
path := rc.JobContainer.GetPathVariableName()
if (*env)[path] == "" {
(*env)[path] = rc.JobContainer.DefaultPathVariable()
}
if rc.ExtraPath != nil && len(rc.ExtraPath) > 0 {
p := (*env)["PATH"]
(*env)["PATH"] = strings.Join(rc.ExtraPath, `:`)
(*env)["PATH"] += `:` + p
(*env)[path] = rc.JobContainer.JoinPathVariable(append(rc.ExtraPath, (*env)[path])...)
}
rc.withGithubEnv(ctx, step.getGithubContext(ctx), *env)